From 43f234c26da870fa4387ec2296a9c2ee3ccc8598 Mon Sep 17 00:00:00 2001 From: Eric Sitarz Date: Wed, 5 Aug 2026 13:11:54 -0500 Subject: [PATCH] updates for latest API version --- .../OrderCloud.SDK.Tests.csproj | 6 +- src/OrderCloud.SDK.Tests/SdkTests.cs | 4 +- src/OrderCloud.SDK/Generated/ErrorCodes.cs | 40 +++++++ src/OrderCloud.SDK/Generated/Models.cs | 112 +++++++++++++++--- src/OrderCloud.SDK/Generated/Resources.cs | 45 ++++++- .../Generated/WebhookPayloads.cs | 57 ++++++++- src/OrderCloud.SDK/OrderCloud.SDK.csproj | 2 +- src/OrderCloud.SDK/OrderCloudException.cs | 8 +- 8 files changed, 243 insertions(+), 31 deletions(-) diff --git a/src/OrderCloud.SDK.Tests/OrderCloud.SDK.Tests.csproj b/src/OrderCloud.SDK.Tests/OrderCloud.SDK.Tests.csproj index 0fb8290..61f1b69 100644 --- a/src/OrderCloud.SDK.Tests/OrderCloud.SDK.Tests.csproj +++ b/src/OrderCloud.SDK.Tests/OrderCloud.SDK.Tests.csproj @@ -15,9 +15,9 @@ - - - + + + diff --git a/src/OrderCloud.SDK.Tests/SdkTests.cs b/src/OrderCloud.SDK.Tests/SdkTests.cs index 4e108b6..13dce07 100644 --- a/src/OrderCloud.SDK.Tests/SdkTests.cs +++ b/src/OrderCloud.SDK.Tests/SdkTests.cs @@ -305,7 +305,7 @@ public void http_error_auth_exception_handled() { httpTest.RespondWith("<>", 502); // auth response with 500 level error code with response that could cause stackoverflow exception if it gets deserialized - AsyncTestDelegate del = async () => await GetClient().Me.GetAsync(); // Will ThrowAuthExceptionAsync + Func del = async () => await GetClient().Me.GetAsync(); // Will ThrowAuthExceptionAsync var response = Assert.ThrowsAsync(del); Assert.NotNull(response); @@ -319,7 +319,7 @@ public void http_error_api_exception_handled() { httpTest.RespondWith("{}"); // auth response httpTest.RespondWith("<>", 504); // api response that could cause stackoverflow exception if it gets deserialized - AsyncTestDelegate del = async () => await GetClient().Me.GetAsync(); //Will ThrowApiExceptionAsync + Func del = async () => await GetClient().Me.GetAsync(); //Will ThrowApiExceptionAsync var response = Assert.ThrowsAsync(del); Assert.NotNull(response); diff --git a/src/OrderCloud.SDK/Generated/ErrorCodes.cs b/src/OrderCloud.SDK/Generated/ErrorCodes.cs index d48425e..60516a2 100644 --- a/src/OrderCloud.SDK/Generated/ErrorCodes.cs +++ b/src/OrderCloud.SDK/Generated/ErrorCodes.cs @@ -106,6 +106,21 @@ public static class BillingAddress /// Cannot PATCH a billing address that was set by ID. Either PATCH the saved address at /addresses/{{id}}, or PUT a complete address at /billto. public const string CannotPatchSetByID = "BillingAddress.CannotPatchSetByID"; } + public static class Bulk + { + /// Product not found. + public const string ProductNotFound = "Bulk.ProductNotFound"; + /// Variant not found. + public const string VariantNotFound = "Bulk.VariantNotFound"; + /// InventoryRecordNotFound not found. + public const string InventoryRecordNotFound = "Bulk.InventoryRecordNotFound"; + /// Product.Inventory must be configured. + public const string InventoryNotConfigured = "Bulk.InventoryNotConfigured"; + /// VariantID is required when Product.Inventory.VariantLevelTracking is true. + public const string VariantIDRequired = "Bulk.VariantIDRequired"; + /// VariantID is not allowed when Product.Inventory.VariantLevelTracking is false. + public const string VariantIDNotAllowed = "Bulk.VariantIDNotAllowed"; + } public static class Bundle { /// Cannot assign a product to a bundle with a different OwnerID. @@ -182,6 +197,11 @@ public static class DeliveryConfig /// The requested synchronization cannot be performed because the associated delivery configuration is disabled. public const string ConfigurationDisabled = "DeliveryConfig.ConfigurationDisabled"; } + public static class Discount + { + /// CategoryID requires a corresponding CatalogID. + public const string CategoryRequiresCatalog = "Discount.CategoryRequiresCatalog"; + } public static class EntitySyncConfig { /// Only one entity sync per entity type can be configured for a marketplace. @@ -422,6 +442,12 @@ public static class Order public const string CannotMixSubmittedAndUnsubmitted = "Order.CannotMixSubmittedAndUnsubmitted"; /// Order status must be Unsubmitted or Awaiting Approval to apply a promotion. public const string CannotApplyPromoBadStatus = "Order.CannotApplyPromoBadStatus"; + /// Cannot repeat an order placed by a different user. + public const string CannotRepeatOtherUsersOrder = "Order.CannotRepeatOtherUsersOrder"; + /// Order must be in a submitted state to repeat. + public const string MustBeSubmittedToRepeat = "Order.MustBeSubmittedToRepeat"; + /// None of the original order's line items are currently available. + public const string RepeatNoAvailableItems = "Order.RepeatNoAvailableItems"; } public static class OrderReturn { @@ -644,6 +670,10 @@ public static class ProductSyncConfig public const string OnlyOneConfigPerMarketplace = "ProductSyncConfig.OnlyOneConfigPerMarketplace"; /// The requested operation is not available because an administrative lock has been placed on product synchronization for this marketplace. Please contact support. public const string AdminLockout = "ProductSyncConfig.AdminLockout"; + /// Must specify between 1 and 5 catalogs for product synchronization. + public const string InvalidCatalogCount = "ProductSyncConfig.InvalidCatalogCount"; + /// Category filtering is only supported when synchronizing a single catalog. + public const string CategoryFilterRequiresSingleCatalog = "ProductSyncConfig.CategoryFilterRequiresSingleCatalog"; } public static class Promotion { @@ -681,6 +711,14 @@ public static class Promotion public const string ValueExpressionCanBeNullIfUseIntegration = "Promotion.ValueExpressionCanBeNullIfUseIntegration"; /// UseIntegration must be false if ValueExpression is not null. public const string UseIntegrationMustBeFalse = "Promotion.UseIntegrationMustBeFalse"; + /// GeneratedCodeCount cannot be greater than 0 when Code is set. + public const string CannotGenerateCodesWithCode = "Promotion.CannotGenerateCodesWithCode"; + /// GeneratedCodeCount cannot be greater than 0 when AutoApply is true. + public const string CannotGenerateCodesForAutoApply = "Promotion.CannotGenerateCodesForAutoApply"; + /// Code is required when GeneratedCodeCount is 0. + public const string CodeRequired = "Promotion.CodeRequired"; + /// GeneratedCodeLength is required when GeneratedCodeCount is greater than 0. + public const string GeneratedCodeLengthRequired = "Promotion.GeneratedCodeLengthRequired"; } public static class PromotionIntegration { @@ -779,6 +817,8 @@ public static class Synchronize { /// EntitySync for AdminUsers is not configured or the delivery configuration is disabled. public const string EntitySyncForAdminUsersNotEnabled = "Synchronize.EntitySyncForAdminUsersNotEnabled"; + /// EntitySync for Catalogs is not configured or the delivery configuration is disabled. + public const string EntitySyncForCatalogNotEnabled = "Synchronize.EntitySyncForCatalogNotEnabled"; /// EntitySync for Categories is not configured or the delivery configuration is disabled. public const string EntitySyncForCategoryNotEnabled = "Synchronize.EntitySyncForCategoryNotEnabled"; /// EntitySync for Buyer is not configured or the delivery configuration is disabled. diff --git a/src/OrderCloud.SDK/Generated/Models.cs b/src/OrderCloud.SDK/Generated/Models.cs index 2d31553..ba700fc 100644 --- a/src/OrderCloud.SDK/Generated/Models.cs +++ b/src/OrderCloud.SDK/Generated/Models.cs @@ -5,7 +5,7 @@ namespace OrderCloud.SDK { public enum AccessLevel { Private, Public, Shareable } - public enum ApiRole { ApiClientAdmin, ApiClientReader, AddressAdmin, AddressReader, AdminAddressAdmin, AdminAddressReader, AdminUserAdmin, AdminUserGroupAdmin, AdminUserGroupReader, AdminUserReader, ApprovalRuleAdmin, ApprovalRuleReader, BundleAdmin, BundleAssignmentAdmin, BundleReader, BuyerAdmin, BuyerImpersonation, BuyerReader, BuyerUserAdmin, BuyerUserReader, CatalogAdmin, CatalogReader, CategoryAdmin, CategoryReader, CostCenterAdmin, CostCenterReader, CreditCardAdmin, CreditCardReader, EntitySyncConfigAdmin, FullAccess, IncrementorAdmin, IncrementorReader, LocaleReader, LocaleAdmin, MeAddressAdmin, MeAdmin, MeCreditCardAdmin, MessageConfigAssignmentAdmin, MeSubscriptionAdmin, MeXpAdmin, OrderAdmin, OrderReader, OverrideShipping, OverrideTax, OverrideUnitPrice, PasswordReset, PriceScheduleAdmin, PriceScheduleReader, ProductAdmin, ProductAssignmentAdmin, ProductCollectionReader, ProductFacetAdmin, ProductFacetReader, ProductReader, ProductSyncConfigAdmin, PromotionAdmin, PromotionReader, SecurityProfileAdmin, SecurityProfileReader, SetSecurityProfile, ShipmentAdmin, ShipmentReader, Shopper, SpendingAccountAdmin, SpendingAccountReader, SubscriptionAdmin, SubscriptionReader, SupplierAddressAdmin, SupplierAddressReader, SupplierAdmin, SupplierReader, SupplierUserAdmin, SupplierUserGroupAdmin, SupplierUserGroupReader, SupplierUserReader, UnsubmittedOrderReader, UserGroupAdmin, UserGroupReader, OpenIDConnectReader, OpenIDConnectAdmin, MessageSenderReader, MessageSenderAdmin, XpIndexAdmin, WebhookReader, WebhookAdmin, IntegrationEventReader, IntegrationEventAdmin, TrackingEventReader, TrackingEventAdmin, DeliveryConfigAdmin, OrderSyncConfigAdmin, ErrorConfigAdmin } + public enum ApiRole { ApiClientAdmin, ApiClientReader, AddressAdmin, AddressReader, AdminAddressAdmin, AdminAddressReader, AdminUserAdmin, AdminUserGroupAdmin, AdminUserGroupReader, AdminUserReader, ApprovalRuleAdmin, ApprovalRuleReader, BulkReader, BundleAdmin, BundleAssignmentAdmin, BundleReader, BuyerAdmin, BuyerImpersonation, BuyerReader, BuyerUserAdmin, BuyerUserReader, CatalogAdmin, CatalogReader, CategoryAdmin, CategoryReader, CostCenterAdmin, CostCenterReader, CreditCardAdmin, CreditCardReader, EntitySyncConfigAdmin, FullAccess, IncrementorAdmin, IncrementorReader, LocaleReader, LocaleAdmin, MeAddressAdmin, MeAdmin, MeCreditCardAdmin, MessageConfigAssignmentAdmin, MeSubscriptionAdmin, MeXpAdmin, OrderAdmin, OrderReader, OverrideShipping, OverrideTax, OverrideUnitPrice, PasswordReset, PriceScheduleAdmin, PriceScheduleReader, ProductAdmin, ProductAssignmentAdmin, ProductCollectionReader, ProductFacetAdmin, ProductFacetReader, ProductReader, ProductSyncConfigAdmin, PromotionAdmin, PromotionReader, SecurityProfileAdmin, SecurityProfileReader, SetSecurityProfile, ShipmentAdmin, ShipmentReader, Shopper, SpendingAccountAdmin, SpendingAccountReader, SubscriptionAdmin, SubscriptionReader, SupplierAddressAdmin, SupplierAddressReader, SupplierAdmin, SupplierReader, SupplierUserAdmin, SupplierUserGroupAdmin, SupplierUserGroupReader, SupplierUserReader, UnsubmittedOrderReader, UserGroupAdmin, UserGroupReader, OpenIDConnectReader, OpenIDConnectAdmin, MessageSenderReader, MessageSenderAdmin, XpIndexAdmin, WebhookReader, WebhookAdmin, IntegrationEventReader, IntegrationEventAdmin, TrackingEventReader, TrackingEventAdmin, DeliveryConfigAdmin, OrderSyncConfigAdmin, ErrorConfigAdmin } public enum ApprovalStatus { Pending, Approved, Declined } public enum ApprovalType { Order, OrderReturn } public enum CommerceRole { Buyer, Seller, Supplier } @@ -47,8 +47,7 @@ public class AddedPromo : OrderCloudModel public string ID { get => GetProp("ID"); set => SetProp("ID", value); } /// If true, certain eligible expression requirements must be met, and the PromotionDiscount will be applied at the line item level. public bool LineItemLevel { get => GetProp("LineItemLevel"); set => SetProp("LineItemLevel", value); } - /// Must be unique. Entered by buyer when adding promo to order. - [Required] + /// Must be unique within a marketplace. Entered by buyer when adding promo to order. Required when GeneratedCodeCount is 0. public string Code { get => GetProp("Code"); set => SetProp("Code", value); } /// Name of the added promo. Max length 100 characters. Searchable: priority level 2. Sortable: priority level 1. public string Name { get => GetProp("Name"); set => SetProp("Name", value); } @@ -92,6 +91,12 @@ public class AddedPromo : OrderCloudModel public bool UseIntegration { get => GetProp("UseIntegration"); set => SetProp("UseIntegration", value); } /// Used to control the order in which promotions are applied when calling the auto apply or refresh endpoint. public int? Priority { get => GetProp("Priority"); set => SetProp("Priority", value); } + /// Features in beta are subject to change and are not available in production. Number of platform-generated single-use codes for this promotion. Mutually exclusive with Code. + public int GeneratedCodeCount { get => GetProp("GeneratedCodeCount"); set => SetProp("GeneratedCodeCount", value); } + /// Features in beta are subject to change and are not available in production. Character length of each generated code (excluding prefix). Required when GeneratedCodeCount > 0. + public int? GeneratedCodeLength { get => GetProp("GeneratedCodeLength"); set => SetProp("GeneratedCodeLength", value); } + /// Features in beta are subject to change and are not available in production. Optional prefix prepended to generated codes, separated by a dash. + public string GeneratedCodePrefix { get => GetProp("GeneratedCodePrefix"); set => SetProp("GeneratedCodePrefix", value); } /// Container for extended (custom) properties of the added promo. public dynamic xp { get => GetProp("xp", new ExpandoObject()); set => SetProp("xp", value); } } @@ -290,6 +295,15 @@ public class ApiClientSecretCreateResponse : OrderCloudModel /// Expiration of the api client secret create response. public DateTimeOffset? Expiration { get => GetProp("Expiration"); set => SetProp("Expiration", value); } } + public class ApiError : OrderCloudModel + { + /// Error code of the api error. + public string ErrorCode { get => GetProp("ErrorCode"); set => SetProp("ErrorCode", value); } + /// Message of the api error. + public string Message { get => GetProp("Message"); set => SetProp("Message", value); } + /// Data of the api error. + public object Data { get => GetProp("Data"); set => SetProp("Data", value); } + } public class ApprovalInfo : OrderCloudModel { /// Comments to be saved with the order approval or denial. @@ -512,6 +526,13 @@ public class BuyerCreditCard : BuyerCreditCard /// Container for extended (custom) properties of the credit card. public new Txp xp { get => GetProp("xp"); set => SetProp("xp", value); } } + public class BuyerDiscount : OrderCloudModel + { + /// ID of the discount. + public string ID { get => GetProp("ID"); set => SetProp("ID", value); } + /// Description of the discount. + public string Description { get => GetProp("Description"); set => SetProp("Description", value); } + } public class BuyerGroup : OrderCloudModel { /// ID of the group. Can only contain characters Aa-Zz, 0-9, -, and _. Searchable: priority level 1. Sortable: priority level 2. @@ -554,7 +575,7 @@ public class BuyerPriceSchedule : OrderCloudModel /// Price breaks of the price schedule. public IList PriceBreaks { get => GetProp>("PriceBreaks", new List()); set => SetProp>("PriceBreaks", value); } /// The best applicable discount for this buyer. Only populated when a discount applies. - public Discount Discount { get => GetProp("Discount"); set => SetProp("Discount", value); } + public BuyerDiscount Discount { get => GetProp("Discount"); set => SetProp("Discount", value); } /// ID of the organization that owns the PriceSchedule. Only the marketplace owner can override the OwnerID on create. public string OwnerID { get => GetProp("OwnerID"); set => SetProp("OwnerID", value); } /// ID of the price schedule. Can only contain characters Aa-Zz, 0-9, -, and _. Searchable: priority level 1. Sortable: priority level 2. @@ -586,15 +607,11 @@ public class BuyerPriceSchedule : OrderCloudModel /// Container for extended (custom) properties of the price schedule. public dynamic xp { get => GetProp("xp", new ExpandoObject()); set => SetProp("xp", value); } } - /// Specific type of the xp property. If not using a custom type, specify dynamic. - /// Specific type of the Discount property. If not using a custom type, specify Discount. - public class BuyerPriceSchedule : BuyerPriceSchedule - where TDiscount : Discount + /// Specific type of the xp property. If not using a custom type, use the non-generic BuyerPriceSchedule class instead. + public class BuyerPriceSchedule : BuyerPriceSchedule { /// Container for extended (custom) properties of the price schedule. public new Txp xp { get => GetProp("xp"); set => SetProp("xp", value); } - /// The best applicable discount for this buyer. Only populated when a discount applies. - public new TDiscount Discount { get => GetProp("Discount"); set => SetProp("Discount", value); } } public class BuyerProduct : OrderCloudModel { @@ -913,6 +930,8 @@ public class Discount : OrderCloudModel public string CategoryID { get => GetProp("CategoryID"); set => SetProp("CategoryID", value); } /// ID of the product. Sortable. public string ProductID { get => GetProp("ProductID"); set => SetProp("ProductID", value); } + /// Controls precedence when multiple discounts apply to the same user and product. Lower number = higher precedence (1 beats 2). Null is applied last. + public int? Priority { get => GetProp("Priority"); set => SetProp("Priority", value); } /// Container for extended (custom) properties of the discount. public dynamic xp { get => GetProp("xp", new ExpandoObject()); set => SetProp("xp", value); } } @@ -953,6 +972,8 @@ public class DiscountedPrices : OrderCloudModel public decimal? SubscriptionPrice { get => GetProp("SubscriptionPrice"); set => SetProp("SubscriptionPrice", value); } /// Discounted bundle price per unit. public decimal? BundlePrice { get => GetProp("BundlePrice"); set => SetProp("BundlePrice", value); } + /// The discount percentage applied (e.g., 10 for 10% off). + public decimal Percent { get => GetProp("Percent"); set => SetProp("Percent", value); } } public class DiscoverEvent : OrderCloudModel { @@ -976,8 +997,7 @@ public class EligiblePromotion : OrderCloudModel public string ID { get => GetProp("ID"); set => SetProp("ID", value); } /// If true, certain eligible expression requirements must be met, and the PromotionDiscount will be applied at the line item level. public bool LineItemLevel { get => GetProp("LineItemLevel"); set => SetProp("LineItemLevel", value); } - /// Must be unique. Entered by buyer when adding promo to order. - [Required] + /// Must be unique within a marketplace. Entered by buyer when adding promo to order. Required when GeneratedCodeCount is 0. public string Code { get => GetProp("Code"); set => SetProp("Code", value); } /// Name of the eligible promotion. Max length 100 characters. Searchable: priority level 2. Sortable: priority level 1. public string Name { get => GetProp("Name"); set => SetProp("Name", value); } @@ -1021,6 +1041,12 @@ public class EligiblePromotion : OrderCloudModel public bool UseIntegration { get => GetProp("UseIntegration"); set => SetProp("UseIntegration", value); } /// Used to control the order in which promotions are applied when calling the auto apply or refresh endpoint. public int? Priority { get => GetProp("Priority"); set => SetProp("Priority", value); } + /// Features in beta are subject to change and are not available in production. Number of platform-generated single-use codes for this promotion. Mutually exclusive with Code. + public int GeneratedCodeCount { get => GetProp("GeneratedCodeCount"); set => SetProp("GeneratedCodeCount", value); } + /// Features in beta are subject to change and are not available in production. Character length of each generated code (excluding prefix). Required when GeneratedCodeCount > 0. + public int? GeneratedCodeLength { get => GetProp("GeneratedCodeLength"); set => SetProp("GeneratedCodeLength", value); } + /// Features in beta are subject to change and are not available in production. Optional prefix prepended to generated codes, separated by a dash. + public string GeneratedCodePrefix { get => GetProp("GeneratedCodePrefix"); set => SetProp("GeneratedCodePrefix", value); } /// Container for extended (custom) properties of the eligible promotion. public dynamic xp { get => GetProp("xp", new ExpandoObject()); set => SetProp("xp", value); } } @@ -2140,8 +2166,7 @@ public class OrderPromotion : OrderCloudModel public string ID { get => GetProp("ID"); set => SetProp("ID", value); } /// If true, certain eligible expression requirements must be met, and the PromotionDiscount will be applied at the line item level. public bool LineItemLevel { get => GetProp("LineItemLevel"); set => SetProp("LineItemLevel", value); } - /// Must be unique. Entered by buyer when adding promo to order. - [Required] + /// Must be unique within a marketplace. Entered by buyer when adding promo to order. Required when GeneratedCodeCount is 0. public string Code { get => GetProp("Code"); set => SetProp("Code", value); } /// Name of the order promotion. Max length 100 characters. Searchable: priority level 2. Sortable: priority level 1. public string Name { get => GetProp("Name"); set => SetProp("Name", value); } @@ -2185,6 +2210,12 @@ public class OrderPromotion : OrderCloudModel public bool UseIntegration { get => GetProp("UseIntegration"); set => SetProp("UseIntegration", value); } /// Used to control the order in which promotions are applied when calling the auto apply or refresh endpoint. public int? Priority { get => GetProp("Priority"); set => SetProp("Priority", value); } + /// Features in beta are subject to change and are not available in production. Number of platform-generated single-use codes for this promotion. Mutually exclusive with Code. + public int GeneratedCodeCount { get => GetProp("GeneratedCodeCount"); set => SetProp("GeneratedCodeCount", value); } + /// Features in beta are subject to change and are not available in production. Character length of each generated code (excluding prefix). Required when GeneratedCodeCount > 0. + public int? GeneratedCodeLength { get => GetProp("GeneratedCodeLength"); set => SetProp("GeneratedCodeLength", value); } + /// Features in beta are subject to change and are not available in production. Optional prefix prepended to generated codes, separated by a dash. + public string GeneratedCodePrefix { get => GetProp("GeneratedCodePrefix"); set => SetProp("GeneratedCodePrefix", value); } /// Container for extended (custom) properties of the order promotion. public dynamic xp { get => GetProp("xp", new ExpandoObject()); set => SetProp("xp", value); } } @@ -2194,6 +2225,20 @@ public class OrderPromotion : OrderPromotion /// Container for extended (custom) properties of the order promotion. public new Txp xp { get => GetProp("xp"); set => SetProp("xp", value); } } + public class OrderRepeatResponse : OrderCloudModel + { + /// The new unsubmitted order created from the original. + public Order Order { get => GetProp("Order"); set => SetProp("Order", value); } + /// Products from the original order that could not be added to the new order. + public IList UnavailableItems { get => GetProp>("UnavailableItems", new List()); set => SetProp>("UnavailableItems", value); } + } + /// Specific type of the Order property. If not using a custom type, use the non-generic OrderRepeatResponse class instead. + public class OrderRepeatResponse : OrderRepeatResponse + where TOrder : Order + { + /// The new unsubmitted order created from the original. + public new TOrder Order { get => GetProp("Order"); set => SetProp("Order", value); } + } public class OrderReturn : OrderCloudModel { /// ID of the order return. Can only contain characters Aa-Zz, 0-9, -, and _. Searchable: priority level 1. Sortable: priority level 3. @@ -3000,8 +3045,7 @@ public class Promotion : OrderCloudModel public string ID { get => GetProp("ID"); set => SetProp("ID", value); } /// If true, certain eligible expression requirements must be met, and the PromotionDiscount will be applied at the line item level. public bool LineItemLevel { get => GetProp("LineItemLevel"); set => SetProp("LineItemLevel", value); } - /// Must be unique. Entered by buyer when adding promo to order. - [Required] + /// Must be unique within a marketplace. Entered by buyer when adding promo to order. Required when GeneratedCodeCount is 0. public string Code { get => GetProp("Code"); set => SetProp("Code", value); } /// Name of the promotion. Max length 100 characters. Searchable: priority level 2. Sortable: priority level 1. public string Name { get => GetProp("Name"); set => SetProp("Name", value); } @@ -3045,6 +3089,12 @@ public class Promotion : OrderCloudModel public bool UseIntegration { get => GetProp("UseIntegration"); set => SetProp("UseIntegration", value); } /// Used to control the order in which promotions are applied when calling the auto apply or refresh endpoint. public int? Priority { get => GetProp("Priority"); set => SetProp("Priority", value); } + /// Features in beta are subject to change and are not available in production. Number of platform-generated single-use codes for this promotion. Mutually exclusive with Code. + public int GeneratedCodeCount { get => GetProp("GeneratedCodeCount"); set => SetProp("GeneratedCodeCount", value); } + /// Features in beta are subject to change and are not available in production. Character length of each generated code (excluding prefix). Required when GeneratedCodeCount > 0. + public int? GeneratedCodeLength { get => GetProp("GeneratedCodeLength"); set => SetProp("GeneratedCodeLength", value); } + /// Features in beta are subject to change and are not available in production. Optional prefix prepended to generated codes, separated by a dash. + public string GeneratedCodePrefix { get => GetProp("GeneratedCodePrefix"); set => SetProp("GeneratedCodePrefix", value); } /// Container for extended (custom) properties of the promotion. public dynamic xp { get => GetProp("xp", new ExpandoObject()); set => SetProp("xp", value); } } @@ -3065,6 +3115,14 @@ public class PromotionAssignment : OrderCloudModel /// ID of the user group. Sortable: priority level 4. public string UserGroupID { get => GetProp("UserGroupID"); set => SetProp("UserGroupID", value); } } + /// Features in beta are subject to change and are not available in production. + public class PromotionCode : OrderCloudModel + { + /// Code of the promotion code. + public string Code { get => GetProp("Code"); set => SetProp("Code", value); } + /// Redeemed of the promotion code. + public bool Redeemed { get => GetProp("Redeemed"); set => SetProp("Redeemed", value); } + } public class PromotionIntegration : OrderCloudModel { /// Security feature that allows your middleware to verify the digital signature in the request header to ensure you only accept trusted data. @@ -3117,8 +3175,7 @@ public class RemovedPromo : OrderCloudModel public string ID { get => GetProp("ID"); set => SetProp("ID", value); } /// If true, certain eligible expression requirements must be met, and the PromotionDiscount will be applied at the line item level. public bool LineItemLevel { get => GetProp("LineItemLevel"); set => SetProp("LineItemLevel", value); } - /// Must be unique. Entered by buyer when adding promo to order. - [Required] + /// Must be unique within a marketplace. Entered by buyer when adding promo to order. Required when GeneratedCodeCount is 0. public string Code { get => GetProp("Code"); set => SetProp("Code", value); } /// Name of the removed promo. Max length 100 characters. Searchable: priority level 2. Sortable: priority level 1. public string Name { get => GetProp("Name"); set => SetProp("Name", value); } @@ -3162,6 +3219,12 @@ public class RemovedPromo : OrderCloudModel public bool UseIntegration { get => GetProp("UseIntegration"); set => SetProp("UseIntegration", value); } /// Used to control the order in which promotions are applied when calling the auto apply or refresh endpoint. public int? Priority { get => GetProp("Priority"); set => SetProp("Priority", value); } + /// Features in beta are subject to change and are not available in production. Number of platform-generated single-use codes for this promotion. Mutually exclusive with Code. + public int GeneratedCodeCount { get => GetProp("GeneratedCodeCount"); set => SetProp("GeneratedCodeCount", value); } + /// Features in beta are subject to change and are not available in production. Character length of each generated code (excluding prefix). Required when GeneratedCodeCount > 0. + public int? GeneratedCodeLength { get => GetProp("GeneratedCodeLength"); set => SetProp("GeneratedCodeLength", value); } + /// Features in beta are subject to change and are not available in production. Optional prefix prepended to generated codes, separated by a dash. + public string GeneratedCodePrefix { get => GetProp("GeneratedCodePrefix"); set => SetProp("GeneratedCodePrefix", value); } /// Container for extended (custom) properties of the removed promo. public dynamic xp { get => GetProp("xp", new ExpandoObject()); set => SetProp("xp", value); } } @@ -3737,6 +3800,12 @@ public class SyncBuyerUserGroup : OrderCloudModel [Required] public string UserGroupID { get => GetProp("UserGroupID"); set => SetProp("UserGroupID", value); } } + public class SyncCatalog : OrderCloudModel + { + /// ID of the catalog. Required. + [Required] + public string CatalogID { get => GetProp("CatalogID"); set => SetProp("CatalogID", value); } + } public class SyncCategory : OrderCloudModel { /// ID of the catalog. Required. @@ -3801,6 +3870,13 @@ public class TrackingEvent : OrderCloudModel [Required] public string DeliveryConfigID { get => GetProp("DeliveryConfigID"); set => SetProp("DeliveryConfigID", value); } } + public class UnavailableLineItem : OrderCloudModel + { + /// ID of the product or bundle that could not be added to the new order. + public string ProductID { get => GetProp("ProductID"); set => SetProp("ProductID", value); } + /// The error indicating why the item could not be added. + public ApiError Error { get => GetProp("Error"); set => SetProp("Error", value); } + } public class User : OrderCloudModel { /// Number of times the user failed authentication due to incorrect password since last successful attempt, or since being unlocked. diff --git a/src/OrderCloud.SDK/Generated/Resources.cs b/src/OrderCloud.SDK/Generated/Resources.cs index 1b422a4..5fe3668 100644 --- a/src/OrderCloud.SDK/Generated/Resources.cs +++ b/src/OrderCloud.SDK/Generated/Resources.cs @@ -789,7 +789,6 @@ public interface IBundleSubscriptionItemsResource Task DeleteAsync(string subscriptionID, string bundleID, string bundleItemID, string accessToken = null); } - /// Features in beta are subject to change and are not available in production. public interface IBuyerGroupsResource { /// Retrieve a buyer group. @@ -1899,6 +1898,24 @@ public interface IDiscountsResource public interface IEntitySyncsResource { + /// Retrieve the entity sync delivery configuration for catalogs Get the entity sync delivery configuration for Catalogs + /// Optional. Use to provide an existing token instead of authenticating implicitly. + Task GetCatalogsAsync(string accessToken = null); + /// Delete the entity sync delivery configuration for catalogs Delete the entity sync delivery configuration for Catalogs + /// Optional. Use to provide an existing token instead of authenticating implicitly. + Task DeleteCatalogsAsync(string accessToken = null); + /// Create or update the entity sync delivery configuration for catalogs Create or update the entity sync delivery configuration for Catalogs + /// The object that will be serialized to JSON and sent in the request body. + /// Optional. Use to provide an existing token instead of authenticating implicitly. + Task SaveCatalogsAsync(EntitySyncConfig entitySyncConfig, string accessToken = null); + /// Partially update the entity sync delivery configuration for catalogs Partially update the entity sync delivery configuration for Catalogs + /// The object that will be partially serialized to JSON and sent in the request body. + /// Optional. Use to provide an existing token instead of authenticating implicitly. + Task PatchCatalogsAsync(PartialEntitySyncConfig partialEntitySyncConfig, string accessToken = null); + /// Sync a catalog + /// The object that will be serialized to JSON and sent in the request body. + /// Optional. Use to provide an existing token instead of authenticating implicitly. + Task SyncCatalogAsync(SyncCatalog syncCatalog, string accessToken = null); /// Retrieve the entity sync delivery configuration for categories Get the entity sync delivery configuration for Categories /// Optional. Use to provide an existing token instead of authenticating implicitly. Task GetCategoriesAsync(string accessToken = null); @@ -4486,6 +4503,18 @@ public interface IOrdersResource /// ID of the order. /// Optional. Use to provide an existing token instead of authenticating implicitly. Task ForwardAsync(OrderDirection direction, string orderID, string accessToken = null) where TOrderSplitResult : OrderSplitResult; + /// Repeat an order Creates a new unsubmitted order from a previously submitted order, copying available line items with recalculated prices. + /// Direction of the order, from the current user's perspective. + /// ID of the order. + /// The object that will be partially serialized to JSON and sent in the request body. + /// Optional. Use to provide an existing token instead of authenticating implicitly. + Task RepeatAsync(OrderDirection direction, string orderID, PartialOrder partialOrder = null, string accessToken = null); + /// Repeat an order Creates a new unsubmitted order from a previously submitted order, copying available line items with recalculated prices. + /// Direction of the order, from the current user's perspective. + /// ID of the order. + /// The object that will be partially serialized to JSON and sent in the request body. + /// Optional. Use to provide an existing token instead of authenticating implicitly. + Task RepeatAsync(OrderDirection direction, string orderID, PartialOrder partialOrder = null, string accessToken = null) where TOrderRepeatResponse : OrderRepeatResponse; /// Complete an order Use only when an order doesn't need a shipment. You will not be able to ship or reopen an order after completing it. /// Direction of the order, from the current user's perspective. /// ID of the order. @@ -5439,6 +5468,12 @@ public interface IPromotionsResource /// The object that will be partially serialized to JSON and sent in the request body. /// Optional. Use to provide an existing token instead of authenticating implicitly. Task PatchAsync(string promotionID, PartialPromotion partialPromotion, string accessToken = null) where TPromotion : Promotion; + /// Features in beta are subject to change and are not available in production. List promotion codes. List generated codes for a promotion. Only applicable when GeneratedCodeCount > 0. + /// ID of the promotion. + /// Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation. + /// Number of results to return per page. + /// Optional. Use to provide an existing token instead of authenticating implicitly. + Task> ListCodesAsync(string promotionID, int page = 1, int pageSize = 20, string accessToken = null); /// List promotion assignments. /// ID of the buyer. /// ID of the promotion. @@ -7473,6 +7508,11 @@ internal DiscountsResource(OrderCloudClient client) : base(client) { } public class EntitySyncsResource : OrderCloudResource, IEntitySyncsResource { internal EntitySyncsResource(OrderCloudClient client) : base(client) { } + public Task GetCatalogsAsync(string accessToken = null) => Request("v1", "integrations", "entitysync", "catalogs").WithOAuthBearerToken(accessToken).GetJsonAsync(); + public Task DeleteCatalogsAsync(string accessToken = null) => Request("v1", "integrations", "entitysync", "catalogs").WithOAuthBearerToken(accessToken).DeleteAsync(); + public Task SaveCatalogsAsync(EntitySyncConfig entitySyncConfig, string accessToken = null) => Request("v1", "integrations", "entitysync", "catalogs").WithOAuthBearerToken(accessToken).PutJsonAsync(ValidateModel(entitySyncConfig)).ReceiveJson(); + public Task PatchCatalogsAsync(PartialEntitySyncConfig partialEntitySyncConfig, string accessToken = null) => Request("v1", "integrations", "entitysync", "catalogs").WithOAuthBearerToken(accessToken).PatchJsonAsync(ValidateModel(partialEntitySyncConfig)).ReceiveJson(); + public Task SyncCatalogAsync(SyncCatalog syncCatalog, string accessToken = null) => Request("v1", "integrations", "entitysync", "catalogs", "sync").WithOAuthBearerToken(accessToken).PostJsonAsync(ValidateModel(syncCatalog)); public Task GetCategoriesAsync(string accessToken = null) => Request("v1", "integrations", "entitysync", "categories").WithOAuthBearerToken(accessToken).GetJsonAsync(); public Task DeleteCategoriesAsync(string accessToken = null) => Request("v1", "integrations", "entitysync", "categories").WithOAuthBearerToken(accessToken).DeleteAsync(); public Task SaveCategoriesAsync(EntitySyncConfig entitySyncConfig, string accessToken = null) => Request("v1", "integrations", "entitysync", "categories").WithOAuthBearerToken(accessToken).PutJsonAsync(ValidateModel(entitySyncConfig)).ReceiveJson(); @@ -7975,6 +8015,8 @@ internal OrdersResource(OrderCloudClient client) : base(client) { } public Task SplitAsync(OrderDirection direction, string orderID, string accessToken = null) where TOrderSplitResult : OrderSplitResult => Request("v1", "orders", direction, orderID, "split").WithOAuthBearerToken(accessToken).PostAsync(null).ReceiveJson(); public Task ForwardAsync(OrderDirection direction, string orderID, string accessToken = null) => ForwardAsync(direction, orderID, accessToken); public Task ForwardAsync(OrderDirection direction, string orderID, string accessToken = null) where TOrderSplitResult : OrderSplitResult => Request("v1", "orders", direction, orderID, "forward").WithOAuthBearerToken(accessToken).PostAsync(null).ReceiveJson(); + public Task RepeatAsync(OrderDirection direction, string orderID, PartialOrder partialOrder = null, string accessToken = null) => RepeatAsync(direction, orderID, partialOrder, accessToken); + public Task RepeatAsync(OrderDirection direction, string orderID, PartialOrder partialOrder = null, string accessToken = null) where TOrderRepeatResponse : OrderRepeatResponse => Request("v1", "orders", direction, orderID, "repeat").WithOAuthBearerToken(accessToken).PostJsonAsync(ValidateModel(partialOrder)).ReceiveJson(); public Task CompleteAsync(OrderDirection direction, string orderID, string accessToken = null) => CompleteAsync(direction, orderID, accessToken); public Task CompleteAsync(OrderDirection direction, string orderID, string accessToken = null) where TOrder : Order => Request("v1", "orders", direction, orderID, "complete").WithOAuthBearerToken(accessToken).PostAsync(null).ReceiveJson(); public Task ShipAsync(OrderDirection direction, string orderID, Shipment shipment, string accessToken = null) => ShipAsync(direction, orderID, shipment, accessToken); @@ -8172,6 +8214,7 @@ internal PromotionsResource(OrderCloudClient client) : base(client) { } public Task DeleteAsync(string promotionID, string accessToken = null) => Request("v1", "promotions", promotionID).WithOAuthBearerToken(accessToken).DeleteAsync(); public Task PatchAsync(string promotionID, PartialPromotion partialPromotion, string accessToken = null) => PatchAsync(promotionID, partialPromotion, accessToken); public Task PatchAsync(string promotionID, PartialPromotion partialPromotion, string accessToken = null) where TPromotion : Promotion => Request("v1", "promotions", promotionID).WithOAuthBearerToken(accessToken).PatchJsonAsync(ValidateModel(partialPromotion)).ReceiveJson(); + public Task> ListCodesAsync(string promotionID, int page = 1, int pageSize = 20, string accessToken = null) => Request("v1", "promotions", promotionID, "codes").WithOAuthBearerToken(accessToken).SetQueryParams(new { page, pageSize }).GetJsonAsync>(); public Task> ListAssignmentsAsync(string buyerID = null, string promotionID = null, string userID = null, string userGroupID = null, PartyType? level = null, int? page = null, int? pageSize = null, string accessToken = null) => Request("v1", "promotions", "assignments").WithOAuthBearerToken(accessToken).SetQueryParams(new { buyerID, promotionID, userID, userGroupID, level, page, pageSize }).GetJsonAsync>(); public Task SaveAssignmentAsync(PromotionAssignment promotionAssignment, string accessToken = null) => Request("v1", "promotions", "assignments").WithOAuthBearerToken(accessToken).PostJsonAsync(ValidateModel(promotionAssignment)); public Task DeleteAssignmentAsync(string promotionID, string buyerID, string userID = null, string userGroupID = null, string accessToken = null) => Request("v1", "promotions", promotionID, "assignments").WithOAuthBearerToken(accessToken).SetQueryParams(new { buyerID, userID, userGroupID }).DeleteAsync(); diff --git a/src/OrderCloud.SDK/Generated/WebhookPayloads.cs b/src/OrderCloud.SDK/Generated/WebhookPayloads.cs index 636105f..ece4cd6 100644 --- a/src/OrderCloud.SDK/Generated/WebhookPayloads.cs +++ b/src/OrderCloud.SDK/Generated/WebhookPayloads.cs @@ -698,7 +698,6 @@ public class DeleteRouteParams public string BundleItemID { get; set; } } } - /// Features in beta are subject to change and are not available in production. public static class BuyerGroups { /// Webhook payload sent by OrderCloud on POST v1/buyergroups. @@ -1770,6 +1769,44 @@ public class DeleteAssignmentRouteParams } public static class EntitySyncs { + /// Webhook payload sent by OrderCloud on DELETE v1/integrations/entitysync/catalogs. + [SentOn("DELETE", "v1/integrations/entitysync/catalogs")] + public class DeleteCatalogs : WebhookPayload { } + /// Webhook payload sent by OrderCloud on DELETE v1/integrations/entitysync/catalogs. + /// Specific type of the ConfigData. If not using a custom type, use the non-generic payload type instead. + [SentOn("DELETE", "v1/integrations/entitysync/catalogs")] + public class DeleteCatalogs : WebhookPayload + { } + /// Webhook payload sent by OrderCloud on PUT v1/integrations/entitysync/catalogs. + [SentOn("PUT", "v1/integrations/entitysync/catalogs")] + public class SaveCatalogs : WebhookPayload { } + /// Webhook payload sent by OrderCloud on PUT v1/integrations/entitysync/catalogs. + /// Specific type of the ConfigData. If not using a custom type, specify dynamic. + /// Specific type of the EntitySyncConfig. If not using a custom type, specify EntitySyncConfig. + [SentOn("PUT", "v1/integrations/entitysync/catalogs")] + public class SaveCatalogs : WebhookPayload + where TEntitySyncConfig : EntitySyncConfig + { } + /// Webhook payload sent by OrderCloud on PATCH v1/integrations/entitysync/catalogs. + [SentOn("PATCH", "v1/integrations/entitysync/catalogs")] + public class PatchCatalogs : WebhookPayload { } + /// Webhook payload sent by OrderCloud on PATCH v1/integrations/entitysync/catalogs. + /// Specific type of the ConfigData. If not using a custom type, specify dynamic. + /// Specific type of the EntitySyncConfig. If not using a custom type, specify EntitySyncConfig. + [SentOn("PATCH", "v1/integrations/entitysync/catalogs")] + public class PatchCatalogs : WebhookPayload + where TEntitySyncConfig : EntitySyncConfig + { } + /// Webhook payload sent by OrderCloud on POST v1/integrations/entitysync/catalogs/sync. + [SentOn("POST", "v1/integrations/entitysync/catalogs/sync")] + public class SyncCatalog : WebhookPayload { } + /// Webhook payload sent by OrderCloud on POST v1/integrations/entitysync/catalogs/sync. + /// Specific type of the ConfigData. If not using a custom type, specify dynamic. + /// Specific type of the SyncCatalog. If not using a custom type, specify SyncCatalog. + [SentOn("POST", "v1/integrations/entitysync/catalogs/sync")] + public class SyncCatalog : WebhookPayload + where TSyncCatalog : SyncCatalog + { } /// Webhook payload sent by OrderCloud on DELETE v1/integrations/entitysync/categories. [SentOn("DELETE", "v1/integrations/entitysync/categories")] public class DeleteCategories : WebhookPayload { } @@ -3782,6 +3819,24 @@ public class ForwardRouteParams public OrderDirection Direction { get; set; } public string OrderID { get; set; } } + /// Webhook payload sent by OrderCloud on POST v1/orders/{direction}/{orderID}/repeat. + [SentOn("POST", "v1/orders/{direction}/{orderID}/repeat")] + public class Repeat : WebhookPayload { } + /// Webhook payload sent by OrderCloud on POST v1/orders/{direction}/{orderID}/repeat. + /// Specific type of the ConfigData. If not using a custom type, specify dynamic. + /// Specific type of the Order. If not using a custom type, specify Order. + /// Specific type of the OrderRepeatResponse. If not using a custom type, specify OrderRepeatResponse. + [SentOn("POST", "v1/orders/{direction}/{orderID}/repeat")] + public class Repeat : WebhookPayload + where TOrder : Order + where TOrderRepeatResponse : OrderRepeatResponse + { } + /// Type used to represent route parameter name/value pairs for v1/orders/{direction}/{orderID}/repeat. + public class RepeatRouteParams + { + public OrderDirection Direction { get; set; } + public string OrderID { get; set; } + } /// Webhook payload sent by OrderCloud on POST v1/orders/{direction}/{orderID}/complete. [SentOn("POST", "v1/orders/{direction}/{orderID}/complete")] public class Complete : WebhookPayload { } diff --git a/src/OrderCloud.SDK/OrderCloud.SDK.csproj b/src/OrderCloud.SDK/OrderCloud.SDK.csproj index 9ca63c3..bb2f559 100644 --- a/src/OrderCloud.SDK/OrderCloud.SDK.csproj +++ b/src/OrderCloud.SDK/OrderCloud.SDK.csproj @@ -4,7 +4,7 @@ netstandard2.0;net461 True - 0.19.1 + 0.19.2 OrderCloud.SDK OrderCloud SDK Todd Menier diff --git a/src/OrderCloud.SDK/OrderCloudException.cs b/src/OrderCloud.SDK/OrderCloudException.cs index ec2ccda..51a7b90 100644 --- a/src/OrderCloud.SDK/OrderCloudException.cs +++ b/src/OrderCloud.SDK/OrderCloudException.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net; @@ -43,10 +43,8 @@ internal class AuthErrorResponse public ApiError[] Errors { get; set; } } - public class ApiError + public class BulkItemError : ApiError { - public string ErrorCode { get; set; } - public string Message { get; set; } - public object Data { get; set; } + public int ItemIndex { get; set; } } }