diff --git a/CodeGeneration/Sourcery/Copiable/Models+Copiable.swifttemplate b/CodeGeneration/Sourcery/Copiable/Models+Copiable.swifttemplate index f755f6e84dc..6f08b0c095a 100644 --- a/CodeGeneration/Sourcery/Copiable/Models+Copiable.swifttemplate +++ b/CodeGeneration/Sourcery/Copiable/Models+Copiable.swifttemplate @@ -183,7 +183,7 @@ let specsToGenerate: [CopiableSpec] = matchingTypes.map { type in } return CopiableSpec( - name: type.name, + name: type.globalName, accessLevelWithSpacePostfix: type.accessLevel == "internal" ? "" : "\(type.accessLevel) ", properties: propSpecs ) diff --git a/CodeGeneration/Sourcery/Fakes/Fakes.swifttemplate b/CodeGeneration/Sourcery/Fakes/Fakes.swifttemplate index f3e705e4817..468df2753b4 100644 --- a/CodeGeneration/Sourcery/Fakes/Fakes.swifttemplate +++ b/CodeGeneration/Sourcery/Fakes/Fakes.swifttemplate @@ -69,7 +69,7 @@ let specsToGenerate: [FakeableSpec] = matchingTypes.map { type in ) } - return FakeableSpec(name: type.name, accessLevelWithSpacePostfix: accessLevel, content: .initializer(propSpecs)) + return FakeableSpec(name: type.globalName, accessLevelWithSpacePostfix: accessLevel, content: .initializer(propSpecs)) } -%> <%# diff --git a/Fakes/Fakes/Hardware.generated.swift b/Fakes/Fakes/Hardware.generated.swift index 46e97c9edf8..b85a1c29f01 100644 --- a/Fakes/Fakes/Hardware.generated.swift +++ b/Fakes/Fakes/Hardware.generated.swift @@ -12,10 +12,10 @@ extension CardBrand { .visa } } -extension CardPresentReceiptParameters { +extension Hardware.CardPresentReceiptParameters { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> CardPresentReceiptParameters { + public static func fake() -> Hardware.CardPresentReceiptParameters { .init( amount: .fake(), formattedAmount: .fake(), @@ -27,10 +27,10 @@ extension CardPresentReceiptParameters { ) } } -extension CardPresentTransactionDetails { +extension Hardware.CardPresentTransactionDetails { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> CardPresentTransactionDetails { + public static func fake() -> Hardware.CardPresentTransactionDetails { .init( last4: .fake(), expMonth: .fake(), @@ -44,10 +44,10 @@ extension CardPresentTransactionDetails { ) } } -extension Charge { +extension Hardware.Charge { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> Charge { + public static func fake() -> Hardware.Charge { .init( id: .fake(), amount: .fake(), @@ -66,10 +66,10 @@ extension ChargeStatus { .succeeded } } -extension PaymentIntent { +extension Hardware.PaymentIntent { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> PaymentIntent { + public static func fake() -> Hardware.PaymentIntent { .init( id: .fake(), status: .fake(), diff --git a/Fakes/Fakes/Networking.generated.swift b/Fakes/Fakes/Networking.generated.swift index eb83ccb8ec0..4e5905f9c99 100644 --- a/Fakes/Fakes/Networking.generated.swift +++ b/Fakes/Fakes/Networking.generated.swift @@ -5,10 +5,10 @@ import Yosemite import Networking import Hardware -extension APNSDevice { +extension Networking.APNSDevice { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> APNSDevice { + public static func fake() -> Networking.APNSDevice { .init( token: .fake(), model: .fake(), @@ -18,10 +18,10 @@ extension APNSDevice { ) } } -extension Account { +extension Networking.Account { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> Account { + public static func fake() -> Networking.Account { .init( userID: .fake(), displayName: .fake(), @@ -31,10 +31,10 @@ extension Account { ) } } -extension AccountSettings { +extension Networking.AccountSettings { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> AccountSettings { + public static func fake() -> Networking.AccountSettings { .init( userID: .fake(), tracksOptOut: .fake(), @@ -50,10 +50,10 @@ extension AddOnDisplay { .dropdown } } -extension AddOnGroup { +extension Networking.AddOnGroup { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> AddOnGroup { + public static func fake() -> Networking.AddOnGroup { .init( siteID: .fake(), groupID: .fake(), @@ -91,10 +91,10 @@ extension AddOnType { .multipleChoice } } -extension Address { +extension Networking.Address { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> Address { + public static func fake() -> Networking.Address { .init( firstName: .fake(), lastName: .fake(), @@ -110,10 +110,10 @@ extension Address { ) } } -extension Country { +extension Networking.Country { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> Country { + public static func fake() -> Networking.Country { .init( code: .fake(), name: .fake(), @@ -121,10 +121,10 @@ extension Country { ) } } -extension Coupon { +extension Networking.Coupon { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> Coupon { + public static func fake() -> Networking.Coupon { .init( siteID: .fake(), couponID: .fake(), @@ -160,10 +160,10 @@ extension Coupon.DiscountType { .percent } } -extension CouponReport { +extension Networking.CouponReport { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> CouponReport { + public static func fake() -> Networking.CouponReport { .init( couponID: .fake(), amount: .fake(), @@ -171,20 +171,20 @@ extension CouponReport { ) } } -extension CreateProductVariation { +extension Networking.CreateProductVariation { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> CreateProductVariation { + public static func fake() -> Networking.CreateProductVariation { .init( regularPrice: .fake(), attributes: .fake() ) } } -extension Customer { +extension Networking.Customer { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> Customer { + public static func fake() -> Networking.Customer { .init( siteID: .fake(), customerID: .fake(), @@ -203,10 +203,10 @@ extension DotcomError { .empty } } -extension DotcomUser { +extension Networking.DotcomUser { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> DotcomUser { + public static func fake() -> Networking.DotcomUser { .init( id: .fake(), username: .fake(), @@ -216,10 +216,10 @@ extension DotcomUser { ) } } -extension InboxAction { +extension Networking.InboxAction { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> InboxAction { + public static func fake() -> Networking.InboxAction { .init( id: .fake(), name: .fake(), @@ -229,10 +229,10 @@ extension InboxAction { ) } } -extension InboxNote { +extension Networking.InboxNote { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> InboxNote { + public static func fake() -> Networking.InboxNote { .init( siteID: .fake(), id: .fake(), @@ -248,10 +248,10 @@ extension InboxNote { ) } } -extension JetpackUser { +extension Networking.JetpackUser { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> JetpackUser { + public static func fake() -> Networking.JetpackUser { .init( isConnected: .fake(), isPrimary: .fake(), @@ -261,10 +261,10 @@ extension JetpackUser { ) } } -extension JustInTimeMessage { +extension Networking.JustInTimeMessage { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> JustInTimeMessage { + public static func fake() -> Networking.JustInTimeMessage { .init( siteID: .fake(), messageID: .fake(), @@ -275,30 +275,30 @@ extension JustInTimeMessage { ) } } -extension JustInTimeMessage.CTA { +extension Networking.JustInTimeMessage.CTA { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> JustInTimeMessage.CTA { + public static func fake() -> Networking.JustInTimeMessage.CTA { .init( message: .fake(), link: .fake() ) } } -extension JustInTimeMessage.Content { +extension Networking.JustInTimeMessage.Content { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> JustInTimeMessage.Content { + public static func fake() -> Networking.JustInTimeMessage.Content { .init( message: .fake(), description: .fake() ) } } -extension Leaderboard { +extension Networking.Leaderboard { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> Leaderboard { + public static func fake() -> Networking.Leaderboard { .init( id: .fake(), label: .fake(), @@ -306,10 +306,10 @@ extension Leaderboard { ) } } -extension Media { +extension Networking.Media { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> Media { + public static func fake() -> Networking.Media { .init( mediaID: .fake(), date: .fake(), @@ -325,10 +325,10 @@ extension Media { ) } } -extension Note { +extension Networking.Note { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> Note { + public static func fake() -> Networking.Note { .init( noteID: .fake(), hash: .fake(), @@ -347,10 +347,10 @@ extension Note { ) } } -extension NoteBlock { +extension Networking.NoteBlock { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> NoteBlock { + public static func fake() -> Networking.NoteBlock { .init( media: .fake(), ranges: .fake(), @@ -361,10 +361,10 @@ extension NoteBlock { ) } } -extension NoteMedia { +extension Networking.NoteMedia { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> NoteMedia { + public static func fake() -> Networking.NoteMedia { .init( type: .fake(), range: .fake(), @@ -373,10 +373,10 @@ extension NoteMedia { ) } } -extension NoteRange { +extension Networking.NoteRange { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> NoteRange { + public static func fake() -> Networking.NoteRange { .init( type: .fake(), range: .fake(), @@ -388,10 +388,10 @@ extension NoteRange { ) } } -extension Order { +extension Networking.Order { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> Order { + public static func fake() -> Networking.Order { .init( siteID: .fake(), orderID: .fake(), @@ -430,10 +430,10 @@ extension Order { ) } } -extension OrderCouponLine { +extension Networking.OrderCouponLine { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> OrderCouponLine { + public static func fake() -> Networking.OrderCouponLine { .init( couponID: .fake(), code: .fake(), @@ -442,10 +442,10 @@ extension OrderCouponLine { ) } } -extension OrderFeeLine { +extension Networking.OrderFeeLine { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> OrderFeeLine { + public static func fake() -> Networking.OrderFeeLine { .init( feeID: .fake(), name: .fake(), @@ -465,10 +465,10 @@ extension OrderFeeTaxStatus { .taxable } } -extension OrderItem { +extension Networking.OrderItem { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> OrderItem { + public static func fake() -> Networking.OrderItem { .init( itemID: .fake(), name: .fake(), @@ -487,10 +487,10 @@ extension OrderItem { ) } } -extension OrderItemAttribute { +extension Networking.OrderItemAttribute { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> OrderItemAttribute { + public static func fake() -> Networking.OrderItemAttribute { .init( metaID: .fake(), name: .fake(), @@ -498,10 +498,10 @@ extension OrderItemAttribute { ) } } -extension OrderItemRefund { +extension Networking.OrderItemRefund { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> OrderItemRefund { + public static func fake() -> Networking.OrderItemRefund { .init( itemID: .fake(), name: .fake(), @@ -520,10 +520,10 @@ extension OrderItemRefund { ) } } -extension OrderItemTax { +extension Networking.OrderItemTax { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> OrderItemTax { + public static func fake() -> Networking.OrderItemTax { .init( taxID: .fake(), subtotal: .fake(), @@ -531,10 +531,10 @@ extension OrderItemTax { ) } } -extension OrderItemTaxRefund { +extension Networking.OrderItemTaxRefund { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> OrderItemTaxRefund { + public static func fake() -> Networking.OrderItemTaxRefund { .init( taxID: .fake(), subtotal: .fake(), @@ -542,10 +542,10 @@ extension OrderItemTaxRefund { ) } } -extension OrderNote { +extension Networking.OrderNote { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> OrderNote { + public static func fake() -> Networking.OrderNote { .init( noteID: .fake(), dateCreated: .fake(), @@ -555,10 +555,10 @@ extension OrderNote { ) } } -extension OrderRefundCondensed { +extension Networking.OrderRefundCondensed { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> OrderRefundCondensed { + public static func fake() -> Networking.OrderRefundCondensed { .init( refundID: .fake(), reason: .fake(), @@ -566,10 +566,10 @@ extension OrderRefundCondensed { ) } } -extension OrderStatsV4 { +extension Networking.OrderStatsV4 { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> OrderStatsV4 { + public static func fake() -> Networking.OrderStatsV4 { .init( siteID: .fake(), granularity: .fake(), @@ -578,10 +578,10 @@ extension OrderStatsV4 { ) } } -extension OrderStatsV4Interval { +extension Networking.OrderStatsV4Interval { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> OrderStatsV4Interval { + public static func fake() -> Networking.OrderStatsV4Interval { .init( interval: .fake(), dateStart: .fake(), @@ -590,10 +590,10 @@ extension OrderStatsV4Interval { ) } } -extension OrderStatsV4Totals { +extension Networking.OrderStatsV4Totals { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> OrderStatsV4Totals { + public static func fake() -> Networking.OrderStatsV4Totals { .init( totalOrders: .fake(), totalItemsSold: .fake(), @@ -608,10 +608,10 @@ extension OrderStatsV4Totals { ) } } -extension OrderStatus { +extension Networking.OrderStatus { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> OrderStatus { + public static func fake() -> Networking.OrderStatus { .init( name: .fake(), siteID: .fake(), @@ -627,10 +627,10 @@ extension OrderStatusEnum { .autoDraft } } -extension OrderTaxLine { +extension Networking.OrderTaxLine { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> OrderTaxLine { + public static func fake() -> Networking.OrderTaxLine { .init( taxID: .fake(), rateCode: .fake(), @@ -644,10 +644,10 @@ extension OrderTaxLine { ) } } -extension PaymentGateway { +extension Networking.PaymentGateway { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> PaymentGateway { + public static func fake() -> Networking.PaymentGateway { .init( siteID: .fake(), gatewayID: .fake(), @@ -659,20 +659,20 @@ extension PaymentGateway { ) } } -extension PaymentGateway.Setting { +extension Networking.PaymentGateway.Setting { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> PaymentGateway.Setting { + public static func fake() -> Networking.PaymentGateway.Setting { .init( settingID: .fake(), value: .fake() ) } } -extension PaymentGatewayAccount { +extension Networking.PaymentGatewayAccount { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> PaymentGatewayAccount { + public static func fake() -> Networking.PaymentGatewayAccount { .init( siteID: .fake(), gatewayID: .fake(), @@ -690,20 +690,20 @@ extension PaymentGatewayAccount { ) } } -extension Post { +extension Networking.Post { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> Post { + public static func fake() -> Networking.Post { .init( siteID: .fake(), password: .fake() ) } } -extension Product { +extension Networking.Product { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> Product { + public static func fake() -> Networking.Product { .init( siteID: .fake(), productID: .fake(), @@ -771,10 +771,10 @@ extension Product { ) } } -extension ProductAddOn { +extension Networking.ProductAddOn { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductAddOn { + public static func fake() -> Networking.ProductAddOn { .init( type: .fake(), display: .fake(), @@ -795,10 +795,10 @@ extension ProductAddOn { ) } } -extension ProductAddOnOption { +extension Networking.ProductAddOnOption { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductAddOnOption { + public static func fake() -> Networking.ProductAddOnOption { .init( label: .fake(), price: .fake(), @@ -807,10 +807,10 @@ extension ProductAddOnOption { ) } } -extension ProductAttribute { +extension Networking.ProductAttribute { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductAttribute { + public static func fake() -> Networking.ProductAttribute { .init( siteID: .fake(), attributeID: .fake(), @@ -822,10 +822,10 @@ extension ProductAttribute { ) } } -extension ProductAttributeTerm { +extension Networking.ProductAttributeTerm { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductAttributeTerm { + public static func fake() -> Networking.ProductAttributeTerm { .init( siteID: .fake(), termID: .fake(), @@ -849,10 +849,10 @@ extension ProductCatalogVisibility { .visible } } -extension ProductCategory { +extension Networking.ProductCategory { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductCategory { + public static func fake() -> Networking.ProductCategory { .init( categoryID: .fake(), siteID: .fake(), @@ -862,10 +862,10 @@ extension ProductCategory { ) } } -extension ProductDefaultAttribute { +extension Networking.ProductDefaultAttribute { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductDefaultAttribute { + public static func fake() -> Networking.ProductDefaultAttribute { .init( attributeID: .fake(), name: .fake(), @@ -873,10 +873,10 @@ extension ProductDefaultAttribute { ) } } -extension ProductDimensions { +extension Networking.ProductDimensions { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductDimensions { + public static func fake() -> Networking.ProductDimensions { .init( length: .fake(), width: .fake(), @@ -884,10 +884,10 @@ extension ProductDimensions { ) } } -extension ProductDownload { +extension Networking.ProductDownload { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductDownload { + public static func fake() -> Networking.ProductDownload { .init( downloadID: .fake(), name: .fake(), @@ -895,19 +895,19 @@ extension ProductDownload { ) } } -extension ProductDownloadDragAndDrop { +extension Networking.ProductDownloadDragAndDrop { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductDownloadDragAndDrop { + public static func fake() -> Networking.ProductDownloadDragAndDrop { .init( downloadableFile: .fake() ) } } -extension ProductImage { +extension Networking.ProductImage { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductImage { + public static func fake() -> Networking.ProductImage { .init( imageID: .fake(), dateCreated: .fake(), @@ -918,10 +918,10 @@ extension ProductImage { ) } } -extension ProductReview { +extension Networking.ProductReview { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductReview { + public static func fake() -> Networking.ProductReview { .init( siteID: .fake(), reviewID: .fake(), @@ -944,10 +944,10 @@ extension ProductReviewStatus { .approved } } -extension ProductShippingClass { +extension Networking.ProductShippingClass { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductShippingClass { + public static func fake() -> Networking.ProductShippingClass { .init( count: .fake(), descriptionHTML: .fake(), @@ -972,10 +972,10 @@ extension ProductStockStatus { .inStock } } -extension ProductTag { +extension Networking.ProductTag { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductTag { + public static func fake() -> Networking.ProductTag { .init( siteID: .fake(), tagID: .fake(), @@ -998,10 +998,10 @@ extension ProductType { .simple } } -extension ProductVariation { +extension Networking.ProductVariation { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductVariation { + public static func fake() -> Networking.ProductVariation { .init( siteID: .fake(), productID: .fake(), @@ -1042,10 +1042,10 @@ extension ProductVariation { ) } } -extension ProductVariationAttribute { +extension Networking.ProductVariationAttribute { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductVariationAttribute { + public static func fake() -> Networking.ProductVariationAttribute { .init( id: .fake(), name: .fake(), @@ -1053,10 +1053,10 @@ extension ProductVariationAttribute { ) } } -extension Refund { +extension Networking.Refund { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> Refund { + public static func fake() -> Networking.Refund { .init( refundID: .fake(), orderID: .fake(), @@ -1072,10 +1072,10 @@ extension Refund { ) } } -extension ShipmentTracking { +extension Networking.ShipmentTracking { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShipmentTracking { + public static func fake() -> Networking.ShipmentTracking { .init( siteID: .fake(), orderID: .fake(), @@ -1087,10 +1087,10 @@ extension ShipmentTracking { ) } } -extension ShipmentTrackingProvider { +extension Networking.ShipmentTrackingProvider { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShipmentTrackingProvider { + public static func fake() -> Networking.ShipmentTrackingProvider { .init( siteID: .fake(), name: .fake(), @@ -1098,10 +1098,10 @@ extension ShipmentTrackingProvider { ) } } -extension ShipmentTrackingProviderGroup { +extension Networking.ShipmentTrackingProviderGroup { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShipmentTrackingProviderGroup { + public static func fake() -> Networking.ShipmentTrackingProviderGroup { .init( name: .fake(), siteID: .fake(), @@ -1109,10 +1109,10 @@ extension ShipmentTrackingProviderGroup { ) } } -extension ShippingLabel { +extension Networking.ShippingLabel { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabel { + public static func fake() -> Networking.ShippingLabel { .init( siteID: .fake(), orderID: .fake(), @@ -1135,10 +1135,10 @@ extension ShippingLabel { ) } } -extension ShippingLabelAccountSettings { +extension Networking.ShippingLabelAccountSettings { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelAccountSettings { + public static func fake() -> Networking.ShippingLabelAccountSettings { .init( siteID: .fake(), canManagePayments: .fake(), @@ -1155,10 +1155,10 @@ extension ShippingLabelAccountSettings { ) } } -extension ShippingLabelAddress { +extension Networking.ShippingLabelAddress { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelAddress { + public static func fake() -> Networking.ShippingLabelAddress { .init( company: .fake(), name: .fake(), @@ -1172,30 +1172,30 @@ extension ShippingLabelAddress { ) } } -extension ShippingLabelAddressValidationError { +extension Networking.ShippingLabelAddressValidationError { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelAddressValidationError { + public static func fake() -> Networking.ShippingLabelAddressValidationError { .init( addressError: .fake(), generalError: .fake() ) } } -extension ShippingLabelAddressValidationSuccess { +extension Networking.ShippingLabelAddressValidationSuccess { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelAddressValidationSuccess { + public static func fake() -> Networking.ShippingLabelAddressValidationSuccess { .init( address: .fake(), isTrivialNormalization: .fake() ) } } -extension ShippingLabelAddressVerification { +extension Networking.ShippingLabelAddressVerification { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelAddressVerification { + public static func fake() -> Networking.ShippingLabelAddressVerification { .init( address: .fake(), type: .fake() @@ -1209,10 +1209,10 @@ extension ShippingLabelAddressVerification.ShipType { .origin } } -extension ShippingLabelCarrierRate { +extension Networking.ShippingLabelCarrierRate { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelCarrierRate { + public static func fake() -> Networking.ShippingLabelCarrierRate { .init( title: .fake(), insurance: .fake(), @@ -1230,20 +1230,20 @@ extension ShippingLabelCarrierRate { ) } } -extension ShippingLabelCreationEligibilityResponse { +extension Networking.ShippingLabelCreationEligibilityResponse { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelCreationEligibilityResponse { + public static func fake() -> Networking.ShippingLabelCreationEligibilityResponse { .init( isEligible: .fake(), reason: .fake() ) } } -extension ShippingLabelCustomPackage { +extension Networking.ShippingLabelCustomPackage { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelCustomPackage { + public static func fake() -> Networking.ShippingLabelCustomPackage { .init( isUserDefined: .fake(), title: .fake(), @@ -1254,10 +1254,10 @@ extension ShippingLabelCustomPackage { ) } } -extension ShippingLabelCustomsForm { +extension Networking.ShippingLabelCustomsForm { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelCustomsForm { + public static func fake() -> Networking.ShippingLabelCustomsForm { .init( packageID: .fake(), packageName: .fake(), @@ -1278,10 +1278,10 @@ extension ShippingLabelCustomsForm.ContentsType { .merchandise } } -extension ShippingLabelCustomsForm.Item { +extension Networking.ShippingLabelCustomsForm.Item { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelCustomsForm.Item { + public static func fake() -> Networking.ShippingLabelCustomsForm.Item { .init( description: .fake(), quantity: .fake(), @@ -1307,10 +1307,10 @@ extension ShippingLabelCustomsForm.RestrictionType { .none } } -extension ShippingLabelPackagePurchase { +extension Networking.ShippingLabelPackagePurchase { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelPackagePurchase { + public static func fake() -> Networking.ShippingLabelPackagePurchase { .init( package: .fake(), rate: .fake(), @@ -1319,10 +1319,10 @@ extension ShippingLabelPackagePurchase { ) } } -extension ShippingLabelPackageSelected { +extension Networking.ShippingLabelPackageSelected { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelPackageSelected { + public static func fake() -> Networking.ShippingLabelPackageSelected { .init( id: .fake(), boxID: .fake(), @@ -1335,10 +1335,10 @@ extension ShippingLabelPackageSelected { ) } } -extension ShippingLabelPackagesResponse { +extension Networking.ShippingLabelPackagesResponse { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelPackagesResponse { + public static func fake() -> Networking.ShippingLabelPackagesResponse { .init( storeOptions: .fake(), customPackages: .fake(), @@ -1361,10 +1361,10 @@ extension ShippingLabelPaymentCardType { .amex } } -extension ShippingLabelPaymentMethod { +extension Networking.ShippingLabelPaymentMethod { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelPaymentMethod { + public static func fake() -> Networking.ShippingLabelPaymentMethod { .init( paymentMethodID: .fake(), name: .fake(), @@ -1374,10 +1374,10 @@ extension ShippingLabelPaymentMethod { ) } } -extension ShippingLabelPredefinedOption { +extension Networking.ShippingLabelPredefinedOption { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelPredefinedOption { + public static func fake() -> Networking.ShippingLabelPredefinedOption { .init( title: .fake(), providerID: .fake(), @@ -1385,10 +1385,10 @@ extension ShippingLabelPredefinedOption { ) } } -extension ShippingLabelPredefinedPackage { +extension Networking.ShippingLabelPredefinedPackage { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelPredefinedPackage { + public static func fake() -> Networking.ShippingLabelPredefinedPackage { .init( id: .fake(), title: .fake(), @@ -1397,20 +1397,20 @@ extension ShippingLabelPredefinedPackage { ) } } -extension ShippingLabelPrintData { +extension Networking.ShippingLabelPrintData { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelPrintData { + public static func fake() -> Networking.ShippingLabelPrintData { .init( mimeType: .fake(), base64Content: .fake() ) } } -extension ShippingLabelPurchase { +extension Networking.ShippingLabelPurchase { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelPurchase { + public static func fake() -> Networking.ShippingLabelPurchase { .init( siteID: .fake(), orderID: .fake(), @@ -1427,10 +1427,10 @@ extension ShippingLabelPurchase { ) } } -extension ShippingLabelRefund { +extension Networking.ShippingLabelRefund { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelRefund { + public static func fake() -> Networking.ShippingLabelRefund { .init( dateRequested: .fake(), status: .fake() @@ -1444,10 +1444,10 @@ extension ShippingLabelRefundStatus { .pending } } -extension ShippingLabelSettings { +extension Networking.ShippingLabelSettings { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelSettings { + public static func fake() -> Networking.ShippingLabelSettings { .init( siteID: .fake(), orderID: .fake(), @@ -1462,10 +1462,10 @@ extension ShippingLabelStatus { .purchased } } -extension ShippingLabelStoreOptions { +extension Networking.ShippingLabelStoreOptions { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLabelStoreOptions { + public static func fake() -> Networking.ShippingLabelStoreOptions { .init( currencySymbol: .fake(), dimensionUnit: .fake(), @@ -1474,10 +1474,10 @@ extension ShippingLabelStoreOptions { ) } } -extension ShippingLine { +extension Networking.ShippingLine { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLine { + public static func fake() -> Networking.ShippingLine { .init( shippingID: .fake(), methodTitle: .fake(), @@ -1488,10 +1488,10 @@ extension ShippingLine { ) } } -extension ShippingLineTax { +extension Networking.ShippingLineTax { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ShippingLineTax { + public static func fake() -> Networking.ShippingLineTax { .init( taxID: .fake(), subtotal: .fake(), @@ -1499,10 +1499,10 @@ extension ShippingLineTax { ) } } -extension Site { +extension Networking.Site { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> Site { + public static func fake() -> Networking.Site { .init( siteID: .fake(), name: .fake(), @@ -1521,30 +1521,30 @@ extension Site { ) } } -extension SiteAPI { +extension Networking.SiteAPI { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> SiteAPI { + public static func fake() -> Networking.SiteAPI { .init( siteID: .fake(), namespaces: .fake() ) } } -extension SitePlan { +extension Networking.SitePlan { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> SitePlan { + public static func fake() -> Networking.SitePlan { .init( siteID: .fake(), shortName: .fake() ) } } -extension SitePlugin { +extension Networking.SitePlugin { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> SitePlugin { + public static func fake() -> Networking.SitePlugin { .init( siteID: .fake(), plugin: .fake(), @@ -1570,10 +1570,10 @@ extension SitePluginStatusEnum { .active } } -extension SiteSetting { +extension Networking.SiteSetting { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> SiteSetting { + public static func fake() -> Networking.SiteSetting { .init( siteID: .fake(), settingID: .fake(), @@ -1591,10 +1591,10 @@ extension SiteSettingGroup { .general } } -extension SiteVisitStats { +extension Networking.SiteVisitStats { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> SiteVisitStats { + public static func fake() -> Networking.SiteVisitStats { .init( siteID: .fake(), date: .fake(), @@ -1603,10 +1603,10 @@ extension SiteVisitStats { ) } } -extension SiteVisitStatsItem { +extension Networking.SiteVisitStatsItem { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> SiteVisitStatsItem { + public static func fake() -> Networking.SiteVisitStatsItem { .init( period: .fake(), visitors: .fake() @@ -1620,10 +1620,10 @@ extension StatGranularity { .day } } -extension StateOfACountry { +extension Networking.StateOfACountry { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> StateOfACountry { + public static func fake() -> Networking.StateOfACountry { .init( code: .fake(), name: .fake() @@ -1637,19 +1637,19 @@ extension StatsGranularityV4 { .hourly } } -extension StoredProductSettings { +extension Networking.StoredProductSettings { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> StoredProductSettings { + public static func fake() -> Networking.StoredProductSettings { .init( settings: .fake() ) } } -extension SystemPlugin { +extension Networking.SystemPlugin { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> SystemPlugin { + public static func fake() -> Networking.SystemPlugin { .init( siteID: .fake(), plugin: .fake(), @@ -1664,10 +1664,10 @@ extension SystemPlugin { ) } } -extension TaxClass { +extension Networking.TaxClass { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> TaxClass { + public static func fake() -> Networking.TaxClass { .init( siteID: .fake(), name: .fake(), @@ -1675,10 +1675,10 @@ extension TaxClass { ) } } -extension TopEarnerStats { +extension Networking.TopEarnerStats { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> TopEarnerStats { + public static func fake() -> Networking.TopEarnerStats { .init( siteID: .fake(), date: .fake(), @@ -1688,10 +1688,10 @@ extension TopEarnerStats { ) } } -extension TopEarnerStatsItem { +extension Networking.TopEarnerStatsItem { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> TopEarnerStatsItem { + public static func fake() -> Networking.TopEarnerStatsItem { .init( productID: .fake(), productName: .fake(), @@ -1703,10 +1703,10 @@ extension TopEarnerStatsItem { ) } } -extension UploadableMedia { +extension Networking.UploadableMedia { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> UploadableMedia { + public static func fake() -> Networking.UploadableMedia { .init( localURL: .fake(), filename: .fake(), @@ -1714,10 +1714,10 @@ extension UploadableMedia { ) } } -extension User { +extension Networking.User { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> User { + public static func fake() -> Networking.User { .init( localID: .fake(), siteID: .fake(), @@ -1730,10 +1730,10 @@ extension User { ) } } -extension WCAnalyticsCustomer { +extension Networking.WCAnalyticsCustomer { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> WCAnalyticsCustomer { + public static func fake() -> Networking.WCAnalyticsCustomer { .init( siteID: .fake(), userID: .fake(), @@ -1762,10 +1762,10 @@ extension WCPayCardFunding { .credit } } -extension WCPayCardPaymentDetails { +extension Networking.WCPayCardPaymentDetails { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> WCPayCardPaymentDetails { + public static func fake() -> Networking.WCPayCardPaymentDetails { .init( brand: .fake(), last4: .fake(), @@ -1773,10 +1773,10 @@ extension WCPayCardPaymentDetails { ) } } -extension WCPayCardPresentPaymentDetails { +extension Networking.WCPayCardPresentPaymentDetails { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> WCPayCardPresentPaymentDetails { + public static func fake() -> Networking.WCPayCardPresentPaymentDetails { .init( brand: .fake(), last4: .fake(), @@ -1785,10 +1785,10 @@ extension WCPayCardPresentPaymentDetails { ) } } -extension WCPayCardPresentReceiptDetails { +extension Networking.WCPayCardPresentReceiptDetails { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> WCPayCardPresentReceiptDetails { + public static func fake() -> Networking.WCPayCardPresentReceiptDetails { .init( accountType: .fake(), applicationPreferredName: .fake(), @@ -1796,10 +1796,10 @@ extension WCPayCardPresentReceiptDetails { ) } } -extension WCPayCharge { +extension Networking.WCPayCharge { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> WCPayCharge { + public static func fake() -> Networking.WCPayCharge { .init( siteID: .fake(), id: .fake(), @@ -1847,10 +1847,10 @@ extension WCPayPaymentMethodType { .card } } -extension WordPressMedia { +extension Networking.WordPressMedia { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> WordPressMedia { + public static func fake() -> Networking.WordPressMedia { .init( mediaID: .fake(), date: .fake(), diff --git a/Fakes/Fakes/Yosemite.generated.swift b/Fakes/Fakes/Yosemite.generated.swift index 9b0e617eec2..a0f9eea5af4 100644 --- a/Fakes/Fakes/Yosemite.generated.swift +++ b/Fakes/Fakes/Yosemite.generated.swift @@ -5,21 +5,10 @@ import Yosemite import Networking import Hardware -extension ProductReviewFromNoteParcel { +extension Yosemite.JustInTimeMessage { /// Returns a "ready to use" type filled with fake values. /// - public static func fake() -> ProductReviewFromNoteParcel { - .init( - note: .fake(), - review: .fake(), - product: .fake() - ) - } -} -extension YosemiteJustInTimeMessage { - /// Returns a "ready to use" type filled with fake values. - /// - public static func fake() -> YosemiteJustInTimeMessage { + public static func fake() -> Yosemite.JustInTimeMessage { .init( siteID: .fake(), messageID: .fake(), @@ -31,3 +20,14 @@ extension YosemiteJustInTimeMessage { ) } } +extension Yosemite.ProductReviewFromNoteParcel { + /// Returns a "ready to use" type filled with fake values. + /// + public static func fake() -> Yosemite.ProductReviewFromNoteParcel { + .init( + note: .fake(), + review: .fake(), + product: .fake() + ) + } +} diff --git a/Hardware/Hardware/Model/Copiable/Models+Copiable.generated.swift b/Hardware/Hardware/Model/Copiable/Models+Copiable.generated.swift index 141c7934c1f..0087c2b0986 100644 --- a/Hardware/Hardware/Model/Copiable/Models+Copiable.generated.swift +++ b/Hardware/Hardware/Model/Copiable/Models+Copiable.generated.swift @@ -4,7 +4,7 @@ import Codegen import UIKit -extension CardPresentReceiptParameters { +extension Hardware.CardPresentReceiptParameters { public func copy( amount: CopiableProp = .copy, formattedAmount: CopiableProp = .copy, @@ -13,7 +13,7 @@ extension CardPresentReceiptParameters { storeName: NullableCopiableProp = .copy, cardDetails: CopiableProp = .copy, orderID: NullableCopiableProp = .copy - ) -> CardPresentReceiptParameters { + ) -> Hardware.CardPresentReceiptParameters { let amount = amount ?? self.amount let formattedAmount = formattedAmount ?? self.formattedAmount let currency = currency ?? self.currency @@ -22,7 +22,7 @@ extension CardPresentReceiptParameters { let cardDetails = cardDetails ?? self.cardDetails let orderID = orderID ?? self.orderID - return CardPresentReceiptParameters( + return Hardware.CardPresentReceiptParameters( amount: amount, formattedAmount: formattedAmount, currency: currency, @@ -34,7 +34,7 @@ extension CardPresentReceiptParameters { } } -extension Charge { +extension Hardware.Charge { public func copy( id: CopiableProp = .copy, amount: CopiableProp = .copy, @@ -43,7 +43,7 @@ extension Charge { description: NullableCopiableProp = .copy, metadata: NullableCopiableProp<[AnyHashable: Any]> = .copy, paymentMethod: NullableCopiableProp = .copy - ) -> Charge { + ) -> Hardware.Charge { let id = id ?? self.id let amount = amount ?? self.amount let currency = currency ?? self.currency @@ -52,7 +52,7 @@ extension Charge { let metadata = metadata ?? self.metadata let paymentMethod = paymentMethod ?? self.paymentMethod - return Charge( + return Hardware.Charge( id: id, amount: amount, currency: currency, @@ -64,7 +64,7 @@ extension Charge { } } -extension PaymentIntent { +extension Hardware.PaymentIntent { public func copy( id: CopiableProp = .copy, status: CopiableProp = .copy, @@ -73,7 +73,7 @@ extension PaymentIntent { currency: CopiableProp = .copy, metadata: NullableCopiableProp<[String: String]> = .copy, charges: CopiableProp<[Charge]> = .copy - ) -> PaymentIntent { + ) -> Hardware.PaymentIntent { let id = id ?? self.id let status = status ?? self.status let created = created ?? self.created @@ -82,7 +82,7 @@ extension PaymentIntent { let metadata = metadata ?? self.metadata let charges = charges ?? self.charges - return PaymentIntent( + return Hardware.PaymentIntent( id: id, status: status, created: created, diff --git a/Networking/Networking/Model/Copiable/Models+Copiable.generated.swift b/Networking/Networking/Model/Copiable/Models+Copiable.generated.swift index 3d9e59ddca6..ec8562fce1a 100644 --- a/Networking/Networking/Model/Copiable/Models+Copiable.generated.swift +++ b/Networking/Networking/Model/Copiable/Models+Copiable.generated.swift @@ -4,21 +4,21 @@ import Codegen import Foundation -extension AddOnGroup { +extension Networking.AddOnGroup { public func copy( siteID: CopiableProp = .copy, groupID: CopiableProp = .copy, name: CopiableProp = .copy, priority: CopiableProp = .copy, addOns: CopiableProp<[ProductAddOn]> = .copy - ) -> AddOnGroup { + ) -> Networking.AddOnGroup { let siteID = siteID ?? self.siteID let groupID = groupID ?? self.groupID let name = name ?? self.name let priority = priority ?? self.priority let addOns = addOns ?? self.addOns - return AddOnGroup( + return Networking.AddOnGroup( siteID: siteID, groupID: groupID, name: name, @@ -28,7 +28,7 @@ extension AddOnGroup { } } -extension Address { +extension Networking.Address { public func copy( firstName: CopiableProp = .copy, lastName: CopiableProp = .copy, @@ -41,7 +41,7 @@ extension Address { country: CopiableProp = .copy, phone: NullableCopiableProp = .copy, email: NullableCopiableProp = .copy - ) -> Address { + ) -> Networking.Address { let firstName = firstName ?? self.firstName let lastName = lastName ?? self.lastName let company = company ?? self.company @@ -54,7 +54,7 @@ extension Address { let phone = phone ?? self.phone let email = email ?? self.email - return Address( + return Networking.Address( firstName: firstName, lastName: lastName, company: company, @@ -70,7 +70,7 @@ extension Address { } } -extension Coupon { +extension Networking.Coupon { public func copy( siteID: CopiableProp = .copy, couponID: CopiableProp = .copy, @@ -96,7 +96,7 @@ extension Coupon { maximumAmount: CopiableProp = .copy, emailRestrictions: CopiableProp<[String]> = .copy, usedBy: CopiableProp<[String]> = .copy - ) -> Coupon { + ) -> Networking.Coupon { let siteID = siteID ?? self.siteID let couponID = couponID ?? self.couponID let code = code ?? self.code @@ -122,7 +122,7 @@ extension Coupon { let emailRestrictions = emailRestrictions ?? self.emailRestrictions let usedBy = usedBy ?? self.usedBy - return Coupon( + return Networking.Coupon( siteID: siteID, couponID: couponID, code: code, @@ -151,17 +151,17 @@ extension Coupon { } } -extension CouponReport { +extension Networking.CouponReport { public func copy( couponID: CopiableProp = .copy, amount: CopiableProp = .copy, ordersCount: CopiableProp = .copy - ) -> CouponReport { + ) -> Networking.CouponReport { let couponID = couponID ?? self.couponID let amount = amount ?? self.amount let ordersCount = ordersCount ?? self.ordersCount - return CouponReport( + return Networking.CouponReport( couponID: couponID, amount: amount, ordersCount: ordersCount @@ -169,7 +169,7 @@ extension CouponReport { } } -extension Customer { +extension Networking.Customer { public func copy( siteID: CopiableProp = .copy, customerID: CopiableProp = .copy, @@ -178,7 +178,7 @@ extension Customer { lastName: NullableCopiableProp = .copy, billing: NullableCopiableProp
= .copy, shipping: NullableCopiableProp
= .copy - ) -> Customer { + ) -> Networking.Customer { let siteID = siteID ?? self.siteID let customerID = customerID ?? self.customerID let email = email ?? self.email @@ -187,7 +187,7 @@ extension Customer { let billing = billing ?? self.billing let shipping = shipping ?? self.shipping - return Customer( + return Networking.Customer( siteID: siteID, customerID: customerID, email: email, @@ -199,21 +199,21 @@ extension Customer { } } -extension DotcomUser { +extension Networking.DotcomUser { public func copy( id: CopiableProp = .copy, username: CopiableProp = .copy, email: CopiableProp = .copy, displayName: CopiableProp = .copy, avatar: NullableCopiableProp = .copy - ) -> DotcomUser { + ) -> Networking.DotcomUser { let id = id ?? self.id let username = username ?? self.username let email = email ?? self.email let displayName = displayName ?? self.displayName let avatar = avatar ?? self.avatar - return DotcomUser( + return Networking.DotcomUser( id: id, username: username, email: email, @@ -223,21 +223,21 @@ extension DotcomUser { } } -extension InboxAction { +extension Networking.InboxAction { public func copy( id: CopiableProp = .copy, name: CopiableProp = .copy, label: CopiableProp = .copy, status: CopiableProp = .copy, url: CopiableProp = .copy - ) -> InboxAction { + ) -> Networking.InboxAction { let id = id ?? self.id let name = name ?? self.name let label = label ?? self.label let status = status ?? self.status let url = url ?? self.url - return InboxAction( + return Networking.InboxAction( id: id, name: name, label: label, @@ -247,7 +247,7 @@ extension InboxAction { } } -extension InboxNote { +extension Networking.InboxNote { public func copy( siteID: CopiableProp = .copy, id: CopiableProp = .copy, @@ -260,7 +260,7 @@ extension InboxNote { isRemoved: CopiableProp = .copy, isRead: CopiableProp = .copy, dateCreated: CopiableProp = .copy - ) -> InboxNote { + ) -> Networking.InboxNote { let siteID = siteID ?? self.siteID let id = id ?? self.id let name = name ?? self.name @@ -273,7 +273,7 @@ extension InboxNote { let isRead = isRead ?? self.isRead let dateCreated = dateCreated ?? self.dateCreated - return InboxNote( + return Networking.InboxNote( siteID: siteID, id: id, name: name, @@ -289,21 +289,21 @@ extension InboxNote { } } -extension JetpackUser { +extension Networking.JetpackUser { public func copy( isConnected: CopiableProp = .copy, isPrimary: CopiableProp = .copy, username: CopiableProp = .copy, wpcomUser: NullableCopiableProp = .copy, gravatar: NullableCopiableProp = .copy - ) -> JetpackUser { + ) -> Networking.JetpackUser { let isConnected = isConnected ?? self.isConnected let isPrimary = isPrimary ?? self.isPrimary let username = username ?? self.username let wpcomUser = wpcomUser ?? self.wpcomUser let gravatar = gravatar ?? self.gravatar - return JetpackUser( + return Networking.JetpackUser( isConnected: isConnected, isPrimary: isPrimary, username: username, @@ -313,7 +313,7 @@ extension JetpackUser { } } -extension JustInTimeMessage { +extension Networking.JustInTimeMessage { public func copy( siteID: CopiableProp = .copy, messageID: CopiableProp = .copy, @@ -321,7 +321,7 @@ extension JustInTimeMessage { ttl: CopiableProp = .copy, content: CopiableProp = .copy, cta: CopiableProp = .copy - ) -> JustInTimeMessage { + ) -> Networking.JustInTimeMessage { let siteID = siteID ?? self.siteID let messageID = messageID ?? self.messageID let featureClass = featureClass ?? self.featureClass @@ -329,7 +329,7 @@ extension JustInTimeMessage { let content = content ?? self.content let cta = cta ?? self.cta - return JustInTimeMessage( + return Networking.JustInTimeMessage( siteID: siteID, messageID: messageID, featureClass: featureClass, @@ -340,37 +340,37 @@ extension JustInTimeMessage { } } -extension JustInTimeMessage.CTA { +extension Networking.JustInTimeMessage.CTA { public func copy( message: CopiableProp = .copy, link: CopiableProp = .copy - ) -> JustInTimeMessage.CTA { + ) -> Networking.JustInTimeMessage.CTA { let message = message ?? self.message let link = link ?? self.link - return JustInTimeMessage.CTA( + return Networking.JustInTimeMessage.CTA( message: message, link: link ) } } -extension JustInTimeMessage.Content { +extension Networking.JustInTimeMessage.Content { public func copy( message: CopiableProp = .copy, description: CopiableProp = .copy - ) -> JustInTimeMessage.Content { + ) -> Networking.JustInTimeMessage.Content { let message = message ?? self.message let description = description ?? self.description - return JustInTimeMessage.Content( + return Networking.JustInTimeMessage.Content( message: message, description: description ) } } -extension Media { +extension Networking.Media { public func copy( mediaID: CopiableProp = .copy, date: CopiableProp = .copy, @@ -383,7 +383,7 @@ extension Media { alt: NullableCopiableProp = .copy, height: NullableCopiableProp = .copy, width: NullableCopiableProp = .copy - ) -> Media { + ) -> Networking.Media { let mediaID = mediaID ?? self.mediaID let date = date ?? self.date let fileExtension = fileExtension ?? self.fileExtension @@ -396,7 +396,7 @@ extension Media { let height = height ?? self.height let width = width ?? self.width - return Media( + return Networking.Media( mediaID: mediaID, date: date, fileExtension: fileExtension, @@ -412,7 +412,7 @@ extension Media { } } -extension Order { +extension Networking.Order { public func copy( siteID: CopiableProp = .copy, orderID: CopiableProp = .copy, @@ -448,7 +448,7 @@ extension Order { fees: CopiableProp<[OrderFeeLine]> = .copy, taxes: CopiableProp<[OrderTaxLine]> = .copy, customFields: CopiableProp<[OrderMetaData]> = .copy - ) -> Order { + ) -> Networking.Order { let siteID = siteID ?? self.siteID let orderID = orderID ?? self.orderID let parentID = parentID ?? self.parentID @@ -484,7 +484,7 @@ extension Order { let taxes = taxes ?? self.taxes let customFields = customFields ?? self.customFields - return Order( + return Networking.Order( siteID: siteID, orderID: orderID, parentID: parentID, @@ -523,7 +523,7 @@ extension Order { } } -extension OrderFeeLine { +extension Networking.OrderFeeLine { public func copy( feeID: CopiableProp = .copy, name: NullableCopiableProp = .copy, @@ -533,7 +533,7 @@ extension OrderFeeLine { totalTax: CopiableProp = .copy, taxes: CopiableProp<[OrderItemTax]> = .copy, attributes: CopiableProp<[OrderItemAttribute]> = .copy - ) -> OrderFeeLine { + ) -> Networking.OrderFeeLine { let feeID = feeID ?? self.feeID let name = name ?? self.name let taxClass = taxClass ?? self.taxClass @@ -543,7 +543,7 @@ extension OrderFeeLine { let taxes = taxes ?? self.taxes let attributes = attributes ?? self.attributes - return OrderFeeLine( + return Networking.OrderFeeLine( feeID: feeID, name: name, taxClass: taxClass, @@ -556,7 +556,7 @@ extension OrderFeeLine { } } -extension OrderItem { +extension Networking.OrderItem { public func copy( itemID: CopiableProp = .copy, name: CopiableProp = .copy, @@ -572,7 +572,7 @@ extension OrderItem { total: CopiableProp = .copy, totalTax: CopiableProp = .copy, attributes: CopiableProp<[OrderItemAttribute]> = .copy - ) -> OrderItem { + ) -> Networking.OrderItem { let itemID = itemID ?? self.itemID let name = name ?? self.name let productID = productID ?? self.productID @@ -588,7 +588,7 @@ extension OrderItem { let totalTax = totalTax ?? self.totalTax let attributes = attributes ?? self.attributes - return OrderItem( + return Networking.OrderItem( itemID: itemID, name: name, productID: productID, @@ -607,17 +607,17 @@ extension OrderItem { } } -extension OrderItemAttribute { +extension Networking.OrderItemAttribute { public func copy( metaID: CopiableProp = .copy, name: CopiableProp = .copy, value: CopiableProp = .copy - ) -> OrderItemAttribute { + ) -> Networking.OrderItemAttribute { let metaID = metaID ?? self.metaID let name = name ?? self.name let value = value ?? self.value - return OrderItemAttribute( + return Networking.OrderItemAttribute( metaID: metaID, name: name, value: value @@ -625,7 +625,7 @@ extension OrderItemAttribute { } } -extension OrderItemRefund { +extension Networking.OrderItemRefund { public func copy( itemID: CopiableProp = .copy, name: CopiableProp = .copy, @@ -641,7 +641,7 @@ extension OrderItemRefund { taxes: CopiableProp<[OrderItemTaxRefund]> = .copy, total: CopiableProp = .copy, totalTax: CopiableProp = .copy - ) -> OrderItemRefund { + ) -> Networking.OrderItemRefund { let itemID = itemID ?? self.itemID let name = name ?? self.name let productID = productID ?? self.productID @@ -657,7 +657,7 @@ extension OrderItemRefund { let total = total ?? self.total let totalTax = totalTax ?? self.totalTax - return OrderItemRefund( + return Networking.OrderItemRefund( itemID: itemID, name: name, productID: productID, @@ -676,19 +676,19 @@ extension OrderItemRefund { } } -extension OrderStatsV4 { +extension Networking.OrderStatsV4 { public func copy( siteID: CopiableProp = .copy, granularity: CopiableProp = .copy, totals: CopiableProp = .copy, intervals: CopiableProp<[OrderStatsV4Interval]> = .copy - ) -> OrderStatsV4 { + ) -> Networking.OrderStatsV4 { let siteID = siteID ?? self.siteID let granularity = granularity ?? self.granularity let totals = totals ?? self.totals let intervals = intervals ?? self.intervals - return OrderStatsV4( + return Networking.OrderStatsV4( siteID: siteID, granularity: granularity, totals: totals, @@ -697,19 +697,19 @@ extension OrderStatsV4 { } } -extension OrderStatsV4Interval { +extension Networking.OrderStatsV4Interval { public func copy( interval: CopiableProp = .copy, dateStart: CopiableProp = .copy, dateEnd: CopiableProp = .copy, subtotals: CopiableProp = .copy - ) -> OrderStatsV4Interval { + ) -> Networking.OrderStatsV4Interval { let interval = interval ?? self.interval let dateStart = dateStart ?? self.dateStart let dateEnd = dateEnd ?? self.dateEnd let subtotals = subtotals ?? self.subtotals - return OrderStatsV4Interval( + return Networking.OrderStatsV4Interval( interval: interval, dateStart: dateStart, dateEnd: dateEnd, @@ -718,7 +718,7 @@ extension OrderStatsV4Interval { } } -extension OrderStatsV4Totals { +extension Networking.OrderStatsV4Totals { public func copy( totalOrders: CopiableProp = .copy, totalItemsSold: CopiableProp = .copy, @@ -730,7 +730,7 @@ extension OrderStatsV4Totals { shipping: CopiableProp = .copy, netRevenue: CopiableProp = .copy, totalProducts: NullableCopiableProp = .copy - ) -> OrderStatsV4Totals { + ) -> Networking.OrderStatsV4Totals { let totalOrders = totalOrders ?? self.totalOrders let totalItemsSold = totalItemsSold ?? self.totalItemsSold let grossRevenue = grossRevenue ?? self.grossRevenue @@ -742,7 +742,7 @@ extension OrderStatsV4Totals { let netRevenue = netRevenue ?? self.netRevenue let totalProducts = totalProducts ?? self.totalProducts - return OrderStatsV4Totals( + return Networking.OrderStatsV4Totals( totalOrders: totalOrders, totalItemsSold: totalItemsSold, grossRevenue: grossRevenue, @@ -757,7 +757,7 @@ extension OrderStatsV4Totals { } } -extension OrderTaxLine { +extension Networking.OrderTaxLine { public func copy( taxID: CopiableProp = .copy, rateCode: CopiableProp = .copy, @@ -768,7 +768,7 @@ extension OrderTaxLine { totalShippingTax: CopiableProp = .copy, ratePercent: CopiableProp = .copy, attributes: CopiableProp<[OrderItemAttribute]> = .copy - ) -> OrderTaxLine { + ) -> Networking.OrderTaxLine { let taxID = taxID ?? self.taxID let rateCode = rateCode ?? self.rateCode let rateID = rateID ?? self.rateID @@ -779,7 +779,7 @@ extension OrderTaxLine { let ratePercent = ratePercent ?? self.ratePercent let attributes = attributes ?? self.attributes - return OrderTaxLine( + return Networking.OrderTaxLine( taxID: taxID, rateCode: rateCode, rateID: rateID, @@ -793,7 +793,7 @@ extension OrderTaxLine { } } -extension PaymentGateway { +extension Networking.PaymentGateway { public func copy( siteID: CopiableProp = .copy, gatewayID: CopiableProp = .copy, @@ -802,7 +802,7 @@ extension PaymentGateway { enabled: CopiableProp = .copy, features: CopiableProp<[PaymentGateway.Feature]> = .copy, instructions: NullableCopiableProp = .copy - ) -> PaymentGateway { + ) -> Networking.PaymentGateway { let siteID = siteID ?? self.siteID let gatewayID = gatewayID ?? self.gatewayID let title = title ?? self.title @@ -811,7 +811,7 @@ extension PaymentGateway { let features = features ?? self.features let instructions = instructions ?? self.instructions - return PaymentGateway( + return Networking.PaymentGateway( siteID: siteID, gatewayID: gatewayID, title: title, @@ -823,22 +823,22 @@ extension PaymentGateway { } } -extension PaymentGateway.Setting { +extension Networking.PaymentGateway.Setting { public func copy( settingID: CopiableProp = .copy, value: CopiableProp = .copy - ) -> PaymentGateway.Setting { + ) -> Networking.PaymentGateway.Setting { let settingID = settingID ?? self.settingID let value = value ?? self.value - return PaymentGateway.Setting( + return Networking.PaymentGateway.Setting( settingID: settingID, value: value ) } } -extension PaymentGatewayAccount { +extension Networking.PaymentGatewayAccount { public func copy( siteID: CopiableProp = .copy, gatewayID: CopiableProp = .copy, @@ -853,7 +853,7 @@ extension PaymentGatewayAccount { isCardPresentEligible: CopiableProp = .copy, isLive: CopiableProp = .copy, isInTestMode: CopiableProp = .copy - ) -> PaymentGatewayAccount { + ) -> Networking.PaymentGatewayAccount { let siteID = siteID ?? self.siteID let gatewayID = gatewayID ?? self.gatewayID let status = status ?? self.status @@ -868,7 +868,7 @@ extension PaymentGatewayAccount { let isLive = isLive ?? self.isLive let isInTestMode = isInTestMode ?? self.isInTestMode - return PaymentGatewayAccount( + return Networking.PaymentGatewayAccount( siteID: siteID, gatewayID: gatewayID, status: status, @@ -886,7 +886,7 @@ extension PaymentGatewayAccount { } } -extension Product { +extension Networking.Product { public func copy( siteID: CopiableProp = .copy, productID: CopiableProp = .copy, @@ -951,7 +951,7 @@ extension Product { groupedProducts: CopiableProp<[Int64]> = .copy, menuOrder: CopiableProp = .copy, addOns: CopiableProp<[ProductAddOn]> = .copy - ) -> Product { + ) -> Networking.Product { let siteID = siteID ?? self.siteID let productID = productID ?? self.productID let name = name ?? self.name @@ -1016,7 +1016,7 @@ extension Product { let menuOrder = menuOrder ?? self.menuOrder let addOns = addOns ?? self.addOns - return Product( + return Networking.Product( siteID: siteID, productID: productID, name: name, @@ -1084,7 +1084,7 @@ extension Product { } } -extension ProductAddOn { +extension Networking.ProductAddOn { public func copy( type: CopiableProp = .copy, display: CopiableProp = .copy, @@ -1102,7 +1102,7 @@ extension ProductAddOn { min: CopiableProp = .copy, max: CopiableProp = .copy, options: CopiableProp<[ProductAddOnOption]> = .copy - ) -> ProductAddOn { + ) -> Networking.ProductAddOn { let type = type ?? self.type let display = display ?? self.display let name = name ?? self.name @@ -1120,7 +1120,7 @@ extension ProductAddOn { let max = max ?? self.max let options = options ?? self.options - return ProductAddOn( + return Networking.ProductAddOn( type: type, display: display, name: name, @@ -1141,19 +1141,19 @@ extension ProductAddOn { } } -extension ProductAddOnOption { +extension Networking.ProductAddOnOption { public func copy( label: NullableCopiableProp = .copy, price: NullableCopiableProp = .copy, priceType: NullableCopiableProp = .copy, imageID: NullableCopiableProp = .copy - ) -> ProductAddOnOption { + ) -> Networking.ProductAddOnOption { let label = label ?? self.label let price = price ?? self.price let priceType = priceType ?? self.priceType let imageID = imageID ?? self.imageID - return ProductAddOnOption( + return Networking.ProductAddOnOption( label: label, price: price, priceType: priceType, @@ -1162,7 +1162,7 @@ extension ProductAddOnOption { } } -extension ProductAttribute { +extension Networking.ProductAttribute { public func copy( siteID: CopiableProp = .copy, attributeID: CopiableProp = .copy, @@ -1171,7 +1171,7 @@ extension ProductAttribute { visible: CopiableProp = .copy, variation: CopiableProp = .copy, options: CopiableProp<[String]> = .copy - ) -> ProductAttribute { + ) -> Networking.ProductAttribute { let siteID = siteID ?? self.siteID let attributeID = attributeID ?? self.attributeID let name = name ?? self.name @@ -1180,7 +1180,7 @@ extension ProductAttribute { let variation = variation ?? self.variation let options = options ?? self.options - return ProductAttribute( + return Networking.ProductAttribute( siteID: siteID, attributeID: attributeID, name: name, @@ -1192,7 +1192,7 @@ extension ProductAttribute { } } -extension ProductImage { +extension Networking.ProductImage { public func copy( imageID: CopiableProp = .copy, dateCreated: CopiableProp = .copy, @@ -1200,7 +1200,7 @@ extension ProductImage { src: CopiableProp = .copy, name: NullableCopiableProp = .copy, alt: NullableCopiableProp = .copy - ) -> ProductImage { + ) -> Networking.ProductImage { let imageID = imageID ?? self.imageID let dateCreated = dateCreated ?? self.dateCreated let dateModified = dateModified ?? self.dateModified @@ -1208,7 +1208,7 @@ extension ProductImage { let name = name ?? self.name let alt = alt ?? self.alt - return ProductImage( + return Networking.ProductImage( imageID: imageID, dateCreated: dateCreated, dateModified: dateModified, @@ -1219,7 +1219,7 @@ extension ProductImage { } } -extension ProductReview { +extension Networking.ProductReview { public func copy( siteID: CopiableProp = .copy, reviewID: CopiableProp = .copy, @@ -1232,7 +1232,7 @@ extension ProductReview { review: CopiableProp = .copy, rating: CopiableProp = .copy, verified: CopiableProp = .copy - ) -> ProductReview { + ) -> Networking.ProductReview { let siteID = siteID ?? self.siteID let reviewID = reviewID ?? self.reviewID let productID = productID ?? self.productID @@ -1245,7 +1245,7 @@ extension ProductReview { let rating = rating ?? self.rating let verified = verified ?? self.verified - return ProductReview( + return Networking.ProductReview( siteID: siteID, reviewID: reviewID, productID: productID, @@ -1261,7 +1261,7 @@ extension ProductReview { } } -extension ProductVariation { +extension Networking.ProductVariation { public func copy( siteID: CopiableProp = .copy, productID: CopiableProp = .copy, @@ -1299,7 +1299,7 @@ extension ProductVariation { shippingClass: NullableCopiableProp = .copy, shippingClassID: CopiableProp = .copy, menuOrder: CopiableProp = .copy - ) -> ProductVariation { + ) -> Networking.ProductVariation { let siteID = siteID ?? self.siteID let productID = productID ?? self.productID let productVariationID = productVariationID ?? self.productVariationID @@ -1337,7 +1337,7 @@ extension ProductVariation { let shippingClassID = shippingClassID ?? self.shippingClassID let menuOrder = menuOrder ?? self.menuOrder - return ProductVariation( + return Networking.ProductVariation( siteID: siteID, productID: productID, productVariationID: productVariationID, @@ -1378,7 +1378,7 @@ extension ProductVariation { } } -extension Refund { +extension Networking.Refund { public func copy( refundID: CopiableProp = .copy, orderID: CopiableProp = .copy, @@ -1391,7 +1391,7 @@ extension Refund { createAutomated: NullableCopiableProp = .copy, items: CopiableProp<[OrderItemRefund]> = .copy, shippingLines: NullableCopiableProp<[ShippingLine]> = .copy - ) -> Refund { + ) -> Networking.Refund { let refundID = refundID ?? self.refundID let orderID = orderID ?? self.orderID let siteID = siteID ?? self.siteID @@ -1404,7 +1404,7 @@ extension Refund { let items = items ?? self.items let shippingLines = shippingLines ?? self.shippingLines - return Refund( + return Networking.Refund( refundID: refundID, orderID: orderID, siteID: siteID, @@ -1420,7 +1420,7 @@ extension Refund { } } -extension ShipmentTracking { +extension Networking.ShipmentTracking { public func copy( siteID: CopiableProp = .copy, orderID: CopiableProp = .copy, @@ -1429,7 +1429,7 @@ extension ShipmentTracking { trackingProvider: NullableCopiableProp = .copy, trackingURL: NullableCopiableProp = .copy, dateShipped: NullableCopiableProp = .copy - ) -> ShipmentTracking { + ) -> Networking.ShipmentTracking { let siteID = siteID ?? self.siteID let orderID = orderID ?? self.orderID let trackingID = trackingID ?? self.trackingID @@ -1438,7 +1438,7 @@ extension ShipmentTracking { let trackingURL = trackingURL ?? self.trackingURL let dateShipped = dateShipped ?? self.dateShipped - return ShipmentTracking( + return Networking.ShipmentTracking( siteID: siteID, orderID: orderID, trackingID: trackingID, @@ -1450,7 +1450,7 @@ extension ShipmentTracking { } } -extension ShippingLabel { +extension Networking.ShippingLabel { public func copy( siteID: CopiableProp = .copy, orderID: CopiableProp = .copy, @@ -1470,7 +1470,7 @@ extension ShippingLabel { productIDs: CopiableProp<[Int64]> = .copy, productNames: CopiableProp<[String]> = .copy, commercialInvoiceURL: NullableCopiableProp = .copy - ) -> ShippingLabel { + ) -> Networking.ShippingLabel { let siteID = siteID ?? self.siteID let orderID = orderID ?? self.orderID let shippingLabelID = shippingLabelID ?? self.shippingLabelID @@ -1490,7 +1490,7 @@ extension ShippingLabel { let productNames = productNames ?? self.productNames let commercialInvoiceURL = commercialInvoiceURL ?? self.commercialInvoiceURL - return ShippingLabel( + return Networking.ShippingLabel( siteID: siteID, orderID: orderID, shippingLabelID: shippingLabelID, @@ -1513,7 +1513,7 @@ extension ShippingLabel { } } -extension ShippingLabelAccountSettings { +extension Networking.ShippingLabelAccountSettings { public func copy( siteID: CopiableProp = .copy, canManagePayments: CopiableProp = .copy, @@ -1527,7 +1527,7 @@ extension ShippingLabelAccountSettings { isEmailReceiptsEnabled: CopiableProp = .copy, paperSize: CopiableProp = .copy, lastSelectedPackageID: CopiableProp = .copy - ) -> ShippingLabelAccountSettings { + ) -> Networking.ShippingLabelAccountSettings { let siteID = siteID ?? self.siteID let canManagePayments = canManagePayments ?? self.canManagePayments let canEditSettings = canEditSettings ?? self.canEditSettings @@ -1541,7 +1541,7 @@ extension ShippingLabelAccountSettings { let paperSize = paperSize ?? self.paperSize let lastSelectedPackageID = lastSelectedPackageID ?? self.lastSelectedPackageID - return ShippingLabelAccountSettings( + return Networking.ShippingLabelAccountSettings( siteID: siteID, canManagePayments: canManagePayments, canEditSettings: canEditSettings, @@ -1558,7 +1558,7 @@ extension ShippingLabelAccountSettings { } } -extension ShippingLabelAddress { +extension Networking.ShippingLabelAddress { public func copy( company: CopiableProp = .copy, name: CopiableProp = .copy, @@ -1569,7 +1569,7 @@ extension ShippingLabelAddress { address2: CopiableProp = .copy, city: CopiableProp = .copy, postcode: CopiableProp = .copy - ) -> ShippingLabelAddress { + ) -> Networking.ShippingLabelAddress { let company = company ?? self.company let name = name ?? self.name let phone = phone ?? self.phone @@ -1580,7 +1580,7 @@ extension ShippingLabelAddress { let city = city ?? self.city let postcode = postcode ?? self.postcode - return ShippingLabelAddress( + return Networking.ShippingLabelAddress( company: company, name: name, phone: phone, @@ -1594,7 +1594,7 @@ extension ShippingLabelAddress { } } -extension ShippingLabelCustomsForm { +extension Networking.ShippingLabelCustomsForm { public func copy( packageID: CopiableProp = .copy, packageName: CopiableProp = .copy, @@ -1605,7 +1605,7 @@ extension ShippingLabelCustomsForm { nonDeliveryOption: CopiableProp = .copy, itn: CopiableProp = .copy, items: CopiableProp<[ShippingLabelCustomsForm.Item]> = .copy - ) -> ShippingLabelCustomsForm { + ) -> Networking.ShippingLabelCustomsForm { let packageID = packageID ?? self.packageID let packageName = packageName ?? self.packageName let contentsType = contentsType ?? self.contentsType @@ -1616,7 +1616,7 @@ extension ShippingLabelCustomsForm { let itn = itn ?? self.itn let items = items ?? self.items - return ShippingLabelCustomsForm( + return Networking.ShippingLabelCustomsForm( packageID: packageID, packageName: packageName, contentsType: contentsType, @@ -1630,7 +1630,7 @@ extension ShippingLabelCustomsForm { } } -extension ShippingLabelCustomsForm.Item { +extension Networking.ShippingLabelCustomsForm.Item { public func copy( description: CopiableProp = .copy, quantity: CopiableProp = .copy, @@ -1639,7 +1639,7 @@ extension ShippingLabelCustomsForm.Item { hsTariffNumber: CopiableProp = .copy, originCountry: CopiableProp = .copy, productID: CopiableProp = .copy - ) -> ShippingLabelCustomsForm.Item { + ) -> Networking.ShippingLabelCustomsForm.Item { let description = description ?? self.description let quantity = quantity ?? self.quantity let value = value ?? self.value @@ -1648,7 +1648,7 @@ extension ShippingLabelCustomsForm.Item { let originCountry = originCountry ?? self.originCountry let productID = productID ?? self.productID - return ShippingLabelCustomsForm.Item( + return Networking.ShippingLabelCustomsForm.Item( description: description, quantity: quantity, value: value, @@ -1660,19 +1660,19 @@ extension ShippingLabelCustomsForm.Item { } } -extension ShippingLabelPackagesResponse { +extension Networking.ShippingLabelPackagesResponse { public func copy( storeOptions: CopiableProp = .copy, customPackages: CopiableProp<[ShippingLabelCustomPackage]> = .copy, predefinedOptions: CopiableProp<[ShippingLabelPredefinedOption]> = .copy, unactivatedPredefinedOptions: CopiableProp<[ShippingLabelPredefinedOption]> = .copy - ) -> ShippingLabelPackagesResponse { + ) -> Networking.ShippingLabelPackagesResponse { let storeOptions = storeOptions ?? self.storeOptions let customPackages = customPackages ?? self.customPackages let predefinedOptions = predefinedOptions ?? self.predefinedOptions let unactivatedPredefinedOptions = unactivatedPredefinedOptions ?? self.unactivatedPredefinedOptions - return ShippingLabelPackagesResponse( + return Networking.ShippingLabelPackagesResponse( storeOptions: storeOptions, customPackages: customPackages, predefinedOptions: predefinedOptions, @@ -1681,21 +1681,21 @@ extension ShippingLabelPackagesResponse { } } -extension ShippingLabelPaymentMethod { +extension Networking.ShippingLabelPaymentMethod { public func copy( paymentMethodID: CopiableProp = .copy, name: CopiableProp = .copy, cardType: CopiableProp = .copy, cardDigits: CopiableProp = .copy, expiry: NullableCopiableProp = .copy - ) -> ShippingLabelPaymentMethod { + ) -> Networking.ShippingLabelPaymentMethod { let paymentMethodID = paymentMethodID ?? self.paymentMethodID let name = name ?? self.name let cardType = cardType ?? self.cardType let cardDigits = cardDigits ?? self.cardDigits let expiry = expiry ?? self.expiry - return ShippingLabelPaymentMethod( + return Networking.ShippingLabelPaymentMethod( paymentMethodID: paymentMethodID, name: name, cardType: cardType, @@ -1705,7 +1705,7 @@ extension ShippingLabelPaymentMethod { } } -extension ShippingLabelPurchase { +extension Networking.ShippingLabelPurchase { public func copy( siteID: CopiableProp = .copy, orderID: CopiableProp = .copy, @@ -1719,7 +1719,7 @@ extension ShippingLabelPurchase { status: CopiableProp = .copy, productIDs: CopiableProp<[Int64]> = .copy, productNames: CopiableProp<[String]> = .copy - ) -> ShippingLabelPurchase { + ) -> Networking.ShippingLabelPurchase { let siteID = siteID ?? self.siteID let orderID = orderID ?? self.orderID let shippingLabelID = shippingLabelID ?? self.shippingLabelID @@ -1733,7 +1733,7 @@ extension ShippingLabelPurchase { let productIDs = productIDs ?? self.productIDs let productNames = productNames ?? self.productNames - return ShippingLabelPurchase( + return Networking.ShippingLabelPurchase( siteID: siteID, orderID: orderID, shippingLabelID: shippingLabelID, @@ -1750,7 +1750,7 @@ extension ShippingLabelPurchase { } } -extension ShippingLine { +extension Networking.ShippingLine { public func copy( shippingID: CopiableProp = .copy, methodTitle: CopiableProp = .copy, @@ -1758,7 +1758,7 @@ extension ShippingLine { total: CopiableProp = .copy, totalTax: CopiableProp = .copy, taxes: CopiableProp<[ShippingLineTax]> = .copy - ) -> ShippingLine { + ) -> Networking.ShippingLine { let shippingID = shippingID ?? self.shippingID let methodTitle = methodTitle ?? self.methodTitle let methodID = methodID ?? self.methodID @@ -1766,7 +1766,7 @@ extension ShippingLine { let totalTax = totalTax ?? self.totalTax let taxes = taxes ?? self.taxes - return ShippingLine( + return Networking.ShippingLine( shippingID: shippingID, methodTitle: methodTitle, methodID: methodID, @@ -1777,7 +1777,7 @@ extension ShippingLine { } } -extension Site { +extension Networking.Site { public func copy( siteID: CopiableProp = .copy, name: CopiableProp = .copy, @@ -1793,7 +1793,7 @@ extension Site { jetpackConnectionActivePlugins: CopiableProp<[String]> = .copy, timezone: CopiableProp = .copy, gmtOffset: CopiableProp = .copy - ) -> Site { + ) -> Networking.Site { let siteID = siteID ?? self.siteID let name = name ?? self.name let description = description ?? self.description @@ -1809,7 +1809,7 @@ extension Site { let timezone = timezone ?? self.timezone let gmtOffset = gmtOffset ?? self.gmtOffset - return Site( + return Networking.Site( siteID: siteID, name: name, description: description, @@ -1828,7 +1828,7 @@ extension Site { } } -extension SitePlugin { +extension Networking.SitePlugin { public func copy( siteID: CopiableProp = .copy, plugin: CopiableProp = .copy, @@ -1844,7 +1844,7 @@ extension SitePlugin { requiresWPVersion: CopiableProp = .copy, requiresPHPVersion: CopiableProp = .copy, textDomain: CopiableProp = .copy - ) -> SitePlugin { + ) -> Networking.SitePlugin { let siteID = siteID ?? self.siteID let plugin = plugin ?? self.plugin let status = status ?? self.status @@ -1860,7 +1860,7 @@ extension SitePlugin { let requiresPHPVersion = requiresPHPVersion ?? self.requiresPHPVersion let textDomain = textDomain ?? self.textDomain - return SitePlugin( + return Networking.SitePlugin( siteID: siteID, plugin: plugin, status: status, @@ -1879,7 +1879,7 @@ extension SitePlugin { } } -extension SiteSetting { +extension Networking.SiteSetting { public func copy( siteID: CopiableProp = .copy, settingID: CopiableProp = .copy, @@ -1887,7 +1887,7 @@ extension SiteSetting { settingDescription: CopiableProp = .copy, value: CopiableProp = .copy, settingGroupKey: CopiableProp = .copy - ) -> SiteSetting { + ) -> Networking.SiteSetting { let siteID = siteID ?? self.siteID let settingID = settingID ?? self.settingID let label = label ?? self.label @@ -1895,7 +1895,7 @@ extension SiteSetting { let value = value ?? self.value let settingGroupKey = settingGroupKey ?? self.settingGroupKey - return SiteSetting( + return Networking.SiteSetting( siteID: siteID, settingID: settingID, label: label, @@ -1906,19 +1906,19 @@ extension SiteSetting { } } -extension SiteVisitStats { +extension Networking.SiteVisitStats { public func copy( siteID: CopiableProp = .copy, date: CopiableProp = .copy, granularity: CopiableProp = .copy, items: NullableCopiableProp<[SiteVisitStatsItem]> = .copy - ) -> SiteVisitStats { + ) -> Networking.SiteVisitStats { let siteID = siteID ?? self.siteID let date = date ?? self.date let granularity = granularity ?? self.granularity let items = items ?? self.items - return SiteVisitStats( + return Networking.SiteVisitStats( siteID: siteID, date: date, granularity: granularity, @@ -1927,22 +1927,22 @@ extension SiteVisitStats { } } -extension SiteVisitStatsItem { +extension Networking.SiteVisitStatsItem { public func copy( period: CopiableProp = .copy, visitors: CopiableProp = .copy - ) -> SiteVisitStatsItem { + ) -> Networking.SiteVisitStatsItem { let period = period ?? self.period let visitors = visitors ?? self.visitors - return SiteVisitStatsItem( + return Networking.SiteVisitStatsItem( period: period, visitors: visitors ) } } -extension SystemPlugin { +extension Networking.SystemPlugin { public func copy( siteID: CopiableProp = .copy, plugin: CopiableProp = .copy, @@ -1954,7 +1954,7 @@ extension SystemPlugin { authorUrl: CopiableProp = .copy, networkActivated: CopiableProp = .copy, active: CopiableProp = .copy - ) -> SystemPlugin { + ) -> Networking.SystemPlugin { let siteID = siteID ?? self.siteID let plugin = plugin ?? self.plugin let name = name ?? self.name @@ -1966,7 +1966,7 @@ extension SystemPlugin { let networkActivated = networkActivated ?? self.networkActivated let active = active ?? self.active - return SystemPlugin( + return Networking.SystemPlugin( siteID: siteID, plugin: plugin, name: name, @@ -1981,7 +1981,7 @@ extension SystemPlugin { } } -extension TopEarnerStatsItem { +extension Networking.TopEarnerStatsItem { public func copy( productID: CopiableProp = .copy, productName: NullableCopiableProp = .copy, @@ -1990,7 +1990,7 @@ extension TopEarnerStatsItem { total: CopiableProp = .copy, currency: CopiableProp = .copy, imageUrl: NullableCopiableProp = .copy - ) -> TopEarnerStatsItem { + ) -> Networking.TopEarnerStatsItem { let productID = productID ?? self.productID let productName = productName ?? self.productName let quantity = quantity ?? self.quantity @@ -1999,7 +1999,7 @@ extension TopEarnerStatsItem { let currency = currency ?? self.currency let imageUrl = imageUrl ?? self.imageUrl - return TopEarnerStatsItem( + return Networking.TopEarnerStatsItem( productID: productID, productName: productName, quantity: quantity, @@ -2011,17 +2011,17 @@ extension TopEarnerStatsItem { } } -extension WCAnalyticsCustomer { +extension Networking.WCAnalyticsCustomer { public func copy( siteID: CopiableProp = .copy, userID: CopiableProp = .copy, name: NullableCopiableProp = .copy - ) -> WCAnalyticsCustomer { + ) -> Networking.WCAnalyticsCustomer { let siteID = siteID ?? self.siteID let userID = userID ?? self.userID let name = name ?? self.name - return WCAnalyticsCustomer( + return Networking.WCAnalyticsCustomer( siteID: siteID, userID: userID, name: name @@ -2029,17 +2029,17 @@ extension WCAnalyticsCustomer { } } -extension WCPayCardPaymentDetails { +extension Networking.WCPayCardPaymentDetails { public func copy( brand: CopiableProp = .copy, last4: CopiableProp = .copy, funding: CopiableProp = .copy - ) -> WCPayCardPaymentDetails { + ) -> Networking.WCPayCardPaymentDetails { let brand = brand ?? self.brand let last4 = last4 ?? self.last4 let funding = funding ?? self.funding - return WCPayCardPaymentDetails( + return Networking.WCPayCardPaymentDetails( brand: brand, last4: last4, funding: funding @@ -2047,19 +2047,19 @@ extension WCPayCardPaymentDetails { } } -extension WCPayCardPresentPaymentDetails { +extension Networking.WCPayCardPresentPaymentDetails { public func copy( brand: CopiableProp = .copy, last4: CopiableProp = .copy, funding: CopiableProp = .copy, receipt: CopiableProp = .copy - ) -> WCPayCardPresentPaymentDetails { + ) -> Networking.WCPayCardPresentPaymentDetails { let brand = brand ?? self.brand let last4 = last4 ?? self.last4 let funding = funding ?? self.funding let receipt = receipt ?? self.receipt - return WCPayCardPresentPaymentDetails( + return Networking.WCPayCardPresentPaymentDetails( brand: brand, last4: last4, funding: funding, @@ -2068,17 +2068,17 @@ extension WCPayCardPresentPaymentDetails { } } -extension WCPayCardPresentReceiptDetails { +extension Networking.WCPayCardPresentReceiptDetails { public func copy( accountType: CopiableProp = .copy, applicationPreferredName: NullableCopiableProp = .copy, dedicatedFileName: NullableCopiableProp = .copy - ) -> WCPayCardPresentReceiptDetails { + ) -> Networking.WCPayCardPresentReceiptDetails { let accountType = accountType ?? self.accountType let applicationPreferredName = applicationPreferredName ?? self.applicationPreferredName let dedicatedFileName = dedicatedFileName ?? self.dedicatedFileName - return WCPayCardPresentReceiptDetails( + return Networking.WCPayCardPresentReceiptDetails( accountType: accountType, applicationPreferredName: applicationPreferredName, dedicatedFileName: dedicatedFileName @@ -2086,7 +2086,7 @@ extension WCPayCardPresentReceiptDetails { } } -extension WCPayCharge { +extension Networking.WCPayCharge { public func copy( siteID: CopiableProp = .copy, id: CopiableProp = .copy, @@ -2103,7 +2103,7 @@ extension WCPayCharge { paymentMethodDetails: CopiableProp = .copy, refunded: CopiableProp = .copy, status: CopiableProp = .copy - ) -> WCPayCharge { + ) -> Networking.WCPayCharge { let siteID = siteID ?? self.siteID let id = id ?? self.id let amount = amount ?? self.amount @@ -2120,7 +2120,7 @@ extension WCPayCharge { let refunded = refunded ?? self.refunded let status = status ?? self.status - return WCPayCharge( + return Networking.WCPayCharge( siteID: siteID, id: id, amount: amount, @@ -2140,7 +2140,7 @@ extension WCPayCharge { } } -extension WordPressMedia { +extension Networking.WordPressMedia { public func copy( mediaID: CopiableProp = .copy, date: CopiableProp = .copy, @@ -2150,7 +2150,7 @@ extension WordPressMedia { alt: NullableCopiableProp = .copy, details: NullableCopiableProp = .copy, title: NullableCopiableProp = .copy - ) -> WordPressMedia { + ) -> Networking.WordPressMedia { let mediaID = mediaID ?? self.mediaID let date = date ?? self.date let slug = slug ?? self.slug @@ -2160,7 +2160,7 @@ extension WordPressMedia { let details = details ?? self.details let title = title ?? self.title - return WordPressMedia( + return Networking.WordPressMedia( mediaID: mediaID, date: date, slug: slug, diff --git a/Storage/Storage/Model/Copiable/Models+Copiable.generated.swift b/Storage/Storage/Model/Copiable/Models+Copiable.generated.swift index 61446aadd77..c16b4d29897 100644 --- a/Storage/Storage/Model/Copiable/Models+Copiable.generated.swift +++ b/Storage/Storage/Model/Copiable/Models+Copiable.generated.swift @@ -4,22 +4,22 @@ import Codegen import Foundation -extension FeatureAnnouncementCampaignSettings { +extension Storage.FeatureAnnouncementCampaignSettings { public func copy( dismissedDate: NullableCopiableProp = .copy, remindAfter: NullableCopiableProp = .copy - ) -> FeatureAnnouncementCampaignSettings { + ) -> Storage.FeatureAnnouncementCampaignSettings { let dismissedDate = dismissedDate ?? self.dismissedDate let remindAfter = remindAfter ?? self.remindAfter - return FeatureAnnouncementCampaignSettings( + return Storage.FeatureAnnouncementCampaignSettings( dismissedDate: dismissedDate, remindAfter: remindAfter ) } } -extension GeneralAppSettings { +extension Storage.GeneralAppSettings { public func copy( installationDate: NullableCopiableProp = .copy, feedbacks: CopiableProp<[FeedbackType: FeedbackSettings]> = .copy, @@ -31,7 +31,7 @@ extension GeneralAppSettings { lastEligibilityErrorInfo: NullableCopiableProp = .copy, lastJetpackBenefitsBannerDismissedTime: NullableCopiableProp = .copy, featureAnnouncementCampaignSettings: CopiableProp<[FeatureAnnouncementCampaign: FeatureAnnouncementCampaignSettings]> = .copy - ) -> GeneralAppSettings { + ) -> Storage.GeneralAppSettings { let installationDate = installationDate ?? self.installationDate let feedbacks = feedbacks ?? self.feedbacks let isViewAddOnsSwitchEnabled = isViewAddOnsSwitchEnabled ?? self.isViewAddOnsSwitchEnabled @@ -43,7 +43,7 @@ extension GeneralAppSettings { let lastJetpackBenefitsBannerDismissedTime = lastJetpackBenefitsBannerDismissedTime ?? self.lastJetpackBenefitsBannerDismissedTime let featureAnnouncementCampaignSettings = featureAnnouncementCampaignSettings ?? self.featureAnnouncementCampaignSettings - return GeneralAppSettings( + return Storage.GeneralAppSettings( installationDate: installationDate, feedbacks: feedbacks, isViewAddOnsSwitchEnabled: isViewAddOnsSwitchEnabled, @@ -58,7 +58,7 @@ extension GeneralAppSettings { } } -extension GeneralStoreSettings { +extension Storage.GeneralStoreSettings { public func copy( isTelemetryAvailable: CopiableProp = .copy, telemetryLastReportedTime: NullableCopiableProp = .copy, @@ -66,7 +66,7 @@ extension GeneralStoreSettings { preferredInPersonPaymentGateway: NullableCopiableProp = .copy, skippedCashOnDeliveryOnboardingStep: CopiableProp = .copy, lastSelectedStatsTimeRange: CopiableProp = .copy - ) -> GeneralStoreSettings { + ) -> Storage.GeneralStoreSettings { let isTelemetryAvailable = isTelemetryAvailable ?? self.isTelemetryAvailable let telemetryLastReportedTime = telemetryLastReportedTime ?? self.telemetryLastReportedTime let areSimplePaymentTaxesEnabled = areSimplePaymentTaxesEnabled ?? self.areSimplePaymentTaxesEnabled @@ -74,7 +74,7 @@ extension GeneralStoreSettings { let skippedCashOnDeliveryOnboardingStep = skippedCashOnDeliveryOnboardingStep ?? self.skippedCashOnDeliveryOnboardingStep let lastSelectedStatsTimeRange = lastSelectedStatsTimeRange ?? self.lastSelectedStatsTimeRange - return GeneralStoreSettings( + return Storage.GeneralStoreSettings( isTelemetryAvailable: isTelemetryAvailable, telemetryLastReportedTime: telemetryLastReportedTime, areSimplePaymentTaxesEnabled: areSimplePaymentTaxesEnabled, diff --git a/WooCommerce/Classes/Copiable/Models+Copiable.generated.swift b/WooCommerce/Classes/Copiable/Models+Copiable.generated.swift index 8f70925fb30..7afd8ec0a19 100644 --- a/WooCommerce/Classes/Copiable/Models+Copiable.generated.swift +++ b/WooCommerce/Classes/Copiable/Models+Copiable.generated.swift @@ -5,7 +5,7 @@ import Foundation import Yosemite -extension AggregateOrderItem { +extension WooCommerce.AggregateOrderItem { func copy( productID: CopiableProp = .copy, variationID: CopiableProp = .copy, @@ -16,7 +16,7 @@ extension AggregateOrderItem { total: NullableCopiableProp = .copy, imageURL: NullableCopiableProp = .copy, attributes: CopiableProp<[OrderItemAttribute]> = .copy - ) -> AggregateOrderItem { + ) -> WooCommerce.AggregateOrderItem { let productID = productID ?? self.productID let variationID = variationID ?? self.variationID let name = name ?? self.name @@ -27,7 +27,7 @@ extension AggregateOrderItem { let imageURL = imageURL ?? self.imageURL let attributes = attributes ?? self.attributes - return AggregateOrderItem( + return WooCommerce.AggregateOrderItem( productID: productID, variationID: variationID, name: name, @@ -41,19 +41,19 @@ extension AggregateOrderItem { } } -extension ShippingLabelSelectedRate { +extension WooCommerce.ShippingLabelSelectedRate { func copy( packageID: CopiableProp = .copy, rate: CopiableProp = .copy, signatureRate: NullableCopiableProp = .copy, adultSignatureRate: NullableCopiableProp = .copy - ) -> ShippingLabelSelectedRate { + ) -> WooCommerce.ShippingLabelSelectedRate { let packageID = packageID ?? self.packageID let rate = rate ?? self.rate let signatureRate = signatureRate ?? self.signatureRate let adultSignatureRate = adultSignatureRate ?? self.adultSignatureRate - return ShippingLabelSelectedRate( + return WooCommerce.ShippingLabelSelectedRate( packageID: packageID, rate: rate, signatureRate: signatureRate, diff --git a/WooCommerce/Classes/ViewModels/Feature Announcement Cards/JustInTimeMessageAnnouncementCardViewModel.swift b/WooCommerce/Classes/ViewModels/Feature Announcement Cards/JustInTimeMessageAnnouncementCardViewModel.swift index 338c8981355..71f222d0a59 100644 --- a/WooCommerce/Classes/ViewModels/Feature Announcement Cards/JustInTimeMessageAnnouncementCardViewModel.swift +++ b/WooCommerce/Classes/ViewModels/Feature Announcement Cards/JustInTimeMessageAnnouncementCardViewModel.swift @@ -11,7 +11,7 @@ final class JustInTimeMessageAnnouncementCardViewModel: AnnouncementCardViewMode private let stores: StoresManager - private let justInTimeMessage: YosemiteJustInTimeMessage + private let justInTimeMessage: JustInTimeMessage // MARK: - Message properties let title: String @@ -28,7 +28,7 @@ final class JustInTimeMessageAnnouncementCardViewModel: AnnouncementCardViewMode private let screenName: String - init(justInTimeMessage: YosemiteJustInTimeMessage, + init(justInTimeMessage: JustInTimeMessage, screenName: String, siteID: Int64, stores: StoresManager = ServiceLocator.stores, diff --git a/WooCommerce/WooCommerceTests/ViewModels/Feature Announcement Cards/JustInTimeMessageAnnouncementCardViewModelTests.swift b/WooCommerce/WooCommerceTests/ViewModels/Feature Announcement Cards/JustInTimeMessageAnnouncementCardViewModelTests.swift index fc8e4b9df93..a1f2ddde2e8 100644 --- a/WooCommerce/WooCommerceTests/ViewModels/Feature Announcement Cards/JustInTimeMessageAnnouncementCardViewModelTests.swift +++ b/WooCommerce/WooCommerceTests/ViewModels/Feature Announcement Cards/JustInTimeMessageAnnouncementCardViewModelTests.swift @@ -23,7 +23,7 @@ final class JustInTimeMessageAnnouncementCardViewModelTests: XCTestCase { stores = MockStoresManager(sessionManager: .makeForTesting()) } - func setUp(with message: YosemiteJustInTimeMessage) { + func setUp(with message: Yosemite.JustInTimeMessage) { sut = JustInTimeMessageAnnouncementCardViewModel(justInTimeMessage: message, screenName: "my_store", siteID: 1234, @@ -41,9 +41,9 @@ final class JustInTimeMessageAnnouncementCardViewModelTests: XCTestCase { func test_ctaTapped_presents_a_webview_with_the_url_adding_correct_utm_parameters() throws { // Given - setUp(with: YosemiteJustInTimeMessage.fake().copy(messageID: "message_id", - featureClass: "feature_class", - url: "https://woocommerce.com/take-action")) + setUp(with: Yosemite.JustInTimeMessage.fake().copy(messageID: "message_id", + featureClass: "feature_class", + url: "https://woocommerce.com/take-action")) // When sut.ctaTapped() @@ -59,7 +59,7 @@ final class JustInTimeMessageAnnouncementCardViewModelTests: XCTestCase { func test_ctaTapped_presents_an_authenticated_webview_for_woocommerce() throws { // Given - setUp(with: YosemiteJustInTimeMessage.fake().copy(url: "https://woocommerce.com/take-action")) + setUp(with: Yosemite.JustInTimeMessage.fake().copy(url: "https://woocommerce.com/take-action")) // When sut.ctaTapped() @@ -71,7 +71,7 @@ final class JustInTimeMessageAnnouncementCardViewModelTests: XCTestCase { func test_ctaTapped_presents_an_authenticated_webview_for_wordpress() throws { // Given - setUp(with: YosemiteJustInTimeMessage.fake().copy(url: "https://wordpress.com/take-action")) + setUp(with: Yosemite.JustInTimeMessage.fake().copy(url: "https://wordpress.com/take-action")) // When sut.ctaTapped() @@ -83,7 +83,7 @@ final class JustInTimeMessageAnnouncementCardViewModelTests: XCTestCase { func test_ctaTapped_presents_an_unauthenticated_webview_for_other_url() throws { // Given - setUp(with: YosemiteJustInTimeMessage.fake().copy(url: "https://example.com/take-action")) + setUp(with: Yosemite.JustInTimeMessage.fake().copy(url: "https://example.com/take-action")) // When sut.ctaTapped() @@ -94,7 +94,7 @@ final class JustInTimeMessageAnnouncementCardViewModelTests: XCTestCase { } func test_ctaTapped_tracks_jitm_cta_tapped_event() { - let message = YosemiteJustInTimeMessage.fake().copy(messageID: "test-message-id", featureClass: "test-feature-class") + let message = Yosemite.JustInTimeMessage.fake().copy(messageID: "test-message-id", featureClass: "test-feature-class") setUp(with: message) // When @@ -106,7 +106,7 @@ final class JustInTimeMessageAnnouncementCardViewModelTests: XCTestCase { func test_dismiss_tracks_jitm_dismissed_event() { // Given - let message = YosemiteJustInTimeMessage.fake().copy(messageID: "test-message-id", featureClass: "test-feature-class") + let message = Yosemite.JustInTimeMessage.fake().copy(messageID: "test-message-id", featureClass: "test-feature-class") setUp(with: message) // When @@ -118,7 +118,7 @@ final class JustInTimeMessageAnnouncementCardViewModelTests: XCTestCase { func test_success_response_on_dismissal_tracks_jitm_dismiss_success_event() { // Given - let message = YosemiteJustInTimeMessage.fake().copy(messageID: "test-message-id", featureClass: "test-feature-class") + let message = Yosemite.JustInTimeMessage.fake().copy(messageID: "test-message-id", featureClass: "test-feature-class") setUp(with: message) stores.whenReceivingAction(ofType: JustInTimeMessageAction.self) { action in @@ -139,7 +139,7 @@ final class JustInTimeMessageAnnouncementCardViewModelTests: XCTestCase { func test_failed_response_on_dismissal_tracks_jitm_dismiss_failed_event() { // Given - let message = YosemiteJustInTimeMessage.fake().copy(messageID: "test-message-id", featureClass: "test-feature-class") + let message = Yosemite.JustInTimeMessage.fake().copy(messageID: "test-message-id", featureClass: "test-feature-class") setUp(with: message) let expectedError = DotcomError.resourceDoesNotExist as NSError @@ -159,14 +159,14 @@ final class JustInTimeMessageAnnouncementCardViewModelTests: XCTestCase { assertAnalyticEventLogged(name: "jitm_dismiss_failure", message: message, error: expectedError) } - private func assertAnalyticEventLogged(name: String, message: YosemiteJustInTimeMessage) { + private func assertAnalyticEventLogged(name: String, message: Yosemite.JustInTimeMessage) { let expectedProperties = ["jitm_id": message.messageID, "jitm_group": message.featureClass, "source": "my_store"] assertAnalyticEventLogged(name: name, expectedProperties: expectedProperties) } - private func assertAnalyticEventLogged(name: String, message: YosemiteJustInTimeMessage, error: Error) { + private func assertAnalyticEventLogged(name: String, message: Yosemite.JustInTimeMessage, error: Error) { let error = error as NSError let expectedProperties = ["jitm_id": message.messageID, "jitm_group": message.featureClass, diff --git a/WooCommerce/WooCommerceTests/ViewRelated/Dashboard/DashboardViewModelTests.swift b/WooCommerce/WooCommerceTests/ViewRelated/Dashboard/DashboardViewModelTests.swift index 0cdcc12ac7d..5296a0b1202 100644 --- a/WooCommerce/WooCommerceTests/ViewRelated/Dashboard/DashboardViewModelTests.swift +++ b/WooCommerce/WooCommerceTests/ViewRelated/Dashboard/DashboardViewModelTests.swift @@ -3,7 +3,7 @@ import enum Networking.DotcomError import enum Yosemite.StatsActionV4 import enum Yosemite.ProductAction import enum Yosemite.JustInTimeMessageAction -import struct Yosemite.YosemiteJustInTimeMessage +import struct Yosemite.JustInTimeMessage @testable import WooCommerce final class DashboardViewModelTests: XCTestCase { @@ -95,7 +95,7 @@ final class DashboardViewModelTests: XCTestCase { stores.whenReceivingAction(ofType: JustInTimeMessageAction.self) { action in switch action { case let .loadMessage(_, _, _, completion): - completion(.success(YosemiteJustInTimeMessage.fake())) + completion(.success(Yosemite.JustInTimeMessage.fake())) default: XCTFail("Received unsupported action: \(action)") } @@ -123,7 +123,7 @@ final class DashboardViewModelTests: XCTestCase { stores.whenReceivingAction(ofType: JustInTimeMessageAction.self) { action in switch action { case let .loadMessage(_, _, _, completion): - completion(.success(YosemiteJustInTimeMessage.fake().copy(title: "JITM Message"))) + completion(.success(Yosemite.JustInTimeMessage.fake().copy(title: "JITM Message"))) default: XCTFail("Received unsupported action: \(action)") } @@ -179,7 +179,7 @@ final class DashboardViewModelTests: XCTestCase { stores.whenReceivingAction(ofType: JustInTimeMessageAction.self) { action in switch action { case let .loadMessage(_, _, _, completion): - completion(.success(YosemiteJustInTimeMessage.fake())) + completion(.success(Yosemite.JustInTimeMessage.fake())) default: XCTFail("Received unsupported action: \(action)") } diff --git a/Yosemite/Yosemite.xcodeproj/project.pbxproj b/Yosemite/Yosemite.xcodeproj/project.pbxproj index 3f66ff38dd3..3c74ae0bbb3 100644 --- a/Yosemite/Yosemite.xcodeproj/project.pbxproj +++ b/Yosemite/Yosemite.xcodeproj/project.pbxproj @@ -103,7 +103,7 @@ 031FD8A026FC970400B315C7 /* RosettaTestingHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031FD89F26FC970300B315C7 /* RosettaTestingHelper.swift */; }; 0366EADF29082B3100B51755 /* JustInTimeMessageStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0366EADE29082B3100B51755 /* JustInTimeMessageStore.swift */; }; 03EB998C2906F1D300F06A39 /* JustInTimeMessageAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03EB998B2906F1D300F06A39 /* JustInTimeMessageAction.swift */; }; - 03EB99902907B97800F06A39 /* YosemiteJustInTimeMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03EB998F2907B97800F06A39 /* YosemiteJustInTimeMessage.swift */; }; + 03EB99902907B97800F06A39 /* JustInTimeMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03EB998F2907B97800F06A39 /* JustInTimeMessage.swift */; }; 03EB99922907EBB300F06A39 /* JustInTimeMessageStoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03EB99912907EBB300F06A39 /* JustInTimeMessageStoreTests.swift */; }; 03F3AFE728097D6400E328BE /* CardPresentPaymentsPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F3AFE628097D6400E328BE /* CardPresentPaymentsPlugin.swift */; }; 03FBDA222631521100ACE257 /* CouponAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03FBDA212631521100ACE257 /* CouponAction.swift */; }; @@ -520,8 +520,7 @@ 031FD89F26FC970300B315C7 /* RosettaTestingHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RosettaTestingHelper.swift; sourceTree = ""; }; 0366EADE29082B3100B51755 /* JustInTimeMessageStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JustInTimeMessageStore.swift; sourceTree = ""; }; 03EB998B2906F1D300F06A39 /* JustInTimeMessageAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JustInTimeMessageAction.swift; sourceTree = ""; }; - 03EB998F2907B97800F06A39 /* YosemiteJustInTimeMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YosemiteJustInTimeMessage.swift; sourceTree = ""; }; - 03EB998D2906F46D00F06A39 /* JustInTimeMessageStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JustInTimeMessageStore.swift; sourceTree = ""; }; + 03EB998F2907B97800F06A39 /* JustInTimeMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JustInTimeMessage.swift; sourceTree = ""; }; 03EB99912907EBB300F06A39 /* JustInTimeMessageStoreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JustInTimeMessageStoreTests.swift; sourceTree = ""; }; 03F3AFE628097D6400E328BE /* CardPresentPaymentsPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardPresentPaymentsPlugin.swift; sourceTree = ""; }; 03FBDA212631521100ACE257 /* CouponAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponAction.swift; sourceTree = ""; }; @@ -1327,7 +1326,7 @@ 0232372722F7DA5500715FAB /* Enums */, B52E0036211A44FE00700FDE /* ReadOnly */, B52E0035211A44F800700FDE /* Storage */, - 03EB998F2907B97800F06A39 /* YosemiteJustInTimeMessage.swift */, + 03EB998F2907B97800F06A39 /* JustInTimeMessage.swift */, B53D89E420E6C22B00F90866 /* Model.swift */, ); path = Model; @@ -2150,7 +2149,7 @@ 247CE84A2583246800F9D9D1 /* MockOrderStatusActionHandler.swift in Sources */, B9AECD402850FE4600E78584 /* Order+CardPresentPayment.swift in Sources */, 7492FADB217FAE4D00ED2C69 /* SiteSetting+ReadOnlyType.swift in Sources */, - 03EB99902907B97800F06A39 /* YosemiteJustInTimeMessage.swift in Sources */, + 03EB99902907B97800F06A39 /* JustInTimeMessage.swift in Sources */, 031C1EAA27B1702800298699 /* WCPayCharge+ReadOnlyConvertible.swift in Sources */, D8652E0D26303A8B00350F37 /* ReceiptAction.swift in Sources */, 0212AC62242C68B600C51F6C /* ResultsController+SortProducts.swift in Sources */, diff --git a/Yosemite/Yosemite/Actions/JustInTimeMessageAction.swift b/Yosemite/Yosemite/Actions/JustInTimeMessageAction.swift index d5c922bcdbb..eb655910fac 100644 --- a/Yosemite/Yosemite/Actions/JustInTimeMessageAction.swift +++ b/Yosemite/Yosemite/Actions/JustInTimeMessageAction.swift @@ -8,11 +8,11 @@ public enum JustInTimeMessageAction: Action { case loadMessage(siteID: Int64, screen: String, hook: JustInTimeMessageHook, - completion: (Result) -> ()) + completion: (Result) -> ()) /// Dismisses a `JustInTimeMessage` and others for the same `featureClass` /// - case dismissMessage(_ message: YosemiteJustInTimeMessage, + case dismissMessage(_ message: JustInTimeMessage, siteID: Int64, completion: (Result) -> ()) } diff --git a/Yosemite/Yosemite/Model/Copiable/Models+Copiable.generated.swift b/Yosemite/Yosemite/Model/Copiable/Models+Copiable.generated.swift index ba895e86cbb..9bb780781bf 100644 --- a/Yosemite/Yosemite/Model/Copiable/Models+Copiable.generated.swift +++ b/Yosemite/Yosemite/Model/Copiable/Models+Copiable.generated.swift @@ -5,25 +5,7 @@ import Foundation import Networking -extension ProductReviewFromNoteParcel { - public func copy( - note: CopiableProp = .copy, - review: CopiableProp = .copy, - product: CopiableProp = .copy - ) -> ProductReviewFromNoteParcel { - let note = note ?? self.note - let review = review ?? self.review - let product = product ?? self.product - - return ProductReviewFromNoteParcel( - note: note, - review: review, - product: product - ) - } -} - -extension YosemiteJustInTimeMessage { +extension Yosemite.JustInTimeMessage { public func copy( siteID: CopiableProp = .copy, messageID: CopiableProp = .copy, @@ -32,7 +14,7 @@ extension YosemiteJustInTimeMessage { detail: CopiableProp = .copy, buttonTitle: CopiableProp = .copy, url: CopiableProp = .copy - ) -> YosemiteJustInTimeMessage { + ) -> Yosemite.JustInTimeMessage { let siteID = siteID ?? self.siteID let messageID = messageID ?? self.messageID let featureClass = featureClass ?? self.featureClass @@ -41,7 +23,7 @@ extension YosemiteJustInTimeMessage { let buttonTitle = buttonTitle ?? self.buttonTitle let url = url ?? self.url - return YosemiteJustInTimeMessage( + return Yosemite.JustInTimeMessage( siteID: siteID, messageID: messageID, featureClass: featureClass, @@ -52,3 +34,21 @@ extension YosemiteJustInTimeMessage { ) } } + +extension Yosemite.ProductReviewFromNoteParcel { + public func copy( + note: CopiableProp = .copy, + review: CopiableProp = .copy, + product: CopiableProp = .copy + ) -> Yosemite.ProductReviewFromNoteParcel { + let note = note ?? self.note + let review = review ?? self.review + let product = product ?? self.product + + return Yosemite.ProductReviewFromNoteParcel( + note: note, + review: review, + product: product + ) + } +} diff --git a/Yosemite/Yosemite/Model/YosemiteJustInTimeMessage.swift b/Yosemite/Yosemite/Model/JustInTimeMessage.swift similarity index 94% rename from Yosemite/Yosemite/Model/YosemiteJustInTimeMessage.swift rename to Yosemite/Yosemite/Model/JustInTimeMessage.swift index e90d1dfe21c..0efd64162b7 100644 --- a/Yosemite/Yosemite/Model/YosemiteJustInTimeMessage.swift +++ b/Yosemite/Yosemite/Model/JustInTimeMessage.swift @@ -2,7 +2,7 @@ import Foundation import Networking import Codegen -public struct YosemiteJustInTimeMessage: GeneratedFakeable, GeneratedCopiable, Equatable { +public struct JustInTimeMessage: GeneratedFakeable, GeneratedCopiable, Equatable { /// Site Identifier /// public let siteID: Int64 diff --git a/Yosemite/Yosemite/Stores/JustInTimeMessageStore.swift b/Yosemite/Yosemite/Stores/JustInTimeMessageStore.swift index f592c94b01f..48694589e9c 100644 --- a/Yosemite/Yosemite/Stores/JustInTimeMessageStore.swift +++ b/Yosemite/Yosemite/Stores/JustInTimeMessageStore.swift @@ -44,7 +44,7 @@ private extension JustInTimeMessageStore { func loadMessage(for siteID: Int64, screen: String, hook: JustInTimeMessageHook, - completion: @escaping (Result) -> ()) { + completion: @escaping (Result) -> ()) { Task { let result = await remote.loadAllJustInTimeMessages( for: siteID, @@ -58,14 +58,14 @@ private extension JustInTimeMessageStore { } } - func topDisplayMessage(_ messages: [Networking.JustInTimeMessage]) -> YosemiteJustInTimeMessage? { + func topDisplayMessage(_ messages: [Networking.JustInTimeMessage]) -> JustInTimeMessage? { guard let topMessage = messages.first else { return nil } - return YosemiteJustInTimeMessage(message: topMessage) + return JustInTimeMessage(message: topMessage) } - func dismissMessage(_ message: YosemiteJustInTimeMessage, + func dismissMessage(_ message: JustInTimeMessage, for siteID: Int64, completion: @escaping (Result) -> ()) { Task { diff --git a/Yosemite/YosemiteTests/Stores/JustInTimeMessageStoreTests.swift b/Yosemite/YosemiteTests/Stores/JustInTimeMessageStoreTests.swift index e44326ccbd5..01e67c32d19 100644 --- a/Yosemite/YosemiteTests/Stores/JustInTimeMessageStoreTests.swift +++ b/Yosemite/YosemiteTests/Stores/JustInTimeMessageStoreTests.swift @@ -61,7 +61,7 @@ final class JustInTimeMessageStoreTests: XCTestCase { self.sut.onAction(action) } - let expectedJustInTimeMessage = YosemiteJustInTimeMessage( + let expectedJustInTimeMessage = JustInTimeMessage( siteID: sampleSiteID, messageID: "woomobile_ipp_barcode_users", featureClass: "woomobile_ipp", @@ -91,7 +91,7 @@ final class JustInTimeMessageStoreTests: XCTestCase { self.sut.onAction(action) } - let expectedJustInTimeMessage = YosemiteJustInTimeMessage( + let expectedJustInTimeMessage = JustInTimeMessage( siteID: sampleSiteID, messageID: "woomobile_onboarding_add_product", featureClass: "woomobile_onboarding_products",