diff --git a/src/OrderCloud.SDK.Tests/SdkTests.cs b/src/OrderCloud.SDK.Tests/SdkTests.cs index b829d19..072a1fd 100644 --- a/src/OrderCloud.SDK.Tests/SdkTests.cs +++ b/src/OrderCloud.SDK.Tests/SdkTests.cs @@ -357,7 +357,7 @@ private class CustomConfigData public int Bar { get; set; } } - class CustomUser : User { } + class CustomUser : OrderUser { } class CustomAddress : Address { } class CustomLineItem : LineItem { } class CustomOrder : Order { } diff --git a/src/OrderCloud.SDK/Generated/ErrorCodes.cs b/src/OrderCloud.SDK/Generated/ErrorCodes.cs index 24e8a3b..53c8f6c 100644 --- a/src/OrderCloud.SDK/Generated/ErrorCodes.cs +++ b/src/OrderCloud.SDK/Generated/ErrorCodes.cs @@ -183,27 +183,6 @@ public static class ErrorConfig /// The error or validation message cannot be sent because the associated delivery configuration is disabled. public const string DeliveryConfigDisabled = "ErrorConfig.DeliveryConfigDisabled"; } - public static class Synchronize - { - /// EntitySync for AdminUsers is not configured or the delivery configuration is disabled. - public const string EntitySyncForAdminUsersNotEnabled = "Synchronize.EntitySyncForAdminUsersNotEnabled"; - /// 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. - public const string EntitySyncForBuyerNotEnabled = "Synchronize.EntitySyncForBuyerNotEnabled"; - /// EntitySync for BuyerUserGroup is not configured or the delivery configuration is disabled. - public const string EntitySyncForBuyerUserGroupNotEnabled = "Synchronize.EntitySyncForBuyerUserGroupNotEnabled"; - /// EntitySync for BuyerUsers is not configured or the delivery configuration is disabled. - public const string EntitySyncForBuyerUsersNotEnabled = "Synchronize.EntitySyncForBuyerUsersNotEnabled"; - /// EntitySync for InventoryRecords is not configured or the delivery configuration is disabled. - public const string EntitySyncForInventoryRecordNotEnabled = "Synchronize.EntitySyncForInventoryRecordNotEnabled"; - /// EntitySync for Supplier is not configured or the delivery configuration is disabled. - public const string EntitySyncForSupplierNotEnabled = "Synchronize.EntitySyncForSupplierNotEnabled"; - /// EntitySync for SupplierUsers is not configured or the delivery configuration is disabled. - public const string EntitySyncForSupplierUsersNotEnabled = "Synchronize.EntitySyncForSupplierUsersNotEnabled "; - /// ProductSync is not configured or the delivery configuration is disabled. - public const string ProductSyncNotEnabled = "Synchronize.ProductSyncNotEnabled"; - } public static class Expression { /// Function has invalid number of arguments. @@ -377,10 +356,6 @@ public static class OneTimePasswordRequest { /// Username or email is required. public const string UsernameOrEmailRequired = "OneTimePasswordRequest.UsernameOrEmailRequired"; - /// No one-time password was sent because accounts associated with this username or email are locked, inactive, or do not have an associated email. - public const string OTPNotSent = "OneTimePasswordRequest.OTPNotSent"; - /// No users with the supplied username or email could be found for the specified API client. - public const string UserNotFoundForClient = "OneTimePasswordRequest.UserNotFoundForClient"; } public static class Order { @@ -696,20 +671,14 @@ public static class Promotion } public static class PromotionIntegration { - /// Failed to evaluate integration promotion. + /// A failed or invalid response was returned from the promotion integration. public const string FailedToEvaluate = "PromotionIntegration.FailedToEvaluate"; - /// Promotion integration returned the error. - public const string EvaluationErrorReturned = "PromotionIntegration.EvaluationErrorReturned"; /// Cannot delete a promotion integration if promotions exist where ValueExpression = null. public const string CannotDeletePromotionIntegration = "PromotionIntegration.CannotDeletePromotionIntegration"; - /// PromotionID in the response does not match any PromosRequested ID in the Promotion Integration payload. - public const string PromotionIDMismatch = "PromotionIntegration.PromotionIDMismatch"; - /// LineItemId is required for LineItemLevel promotion. + /// LineItemID is required on the accepted promotion because it is an item-level promotion. public const string LineItemIdRequired = "PromotionIntegration.LineItemIdRequired"; - /// LineItemId must be null for not LineItemLevel promotion. + /// LineItemID is not allowed on the accepted promotion because it is an order-level promotion. public const string LineItemIdMustBeNull = "PromotionIntegration.LineItemIdMustBeNull"; - /// Promotion cannot be used on this order. - public const string NotEligible = "PromotionIntegration.NotEligible"; } public static class Registration { @@ -793,6 +762,27 @@ public static class SubscriptionIntegration /// You have exceeded the maximum number of subscription integration runs per hour. public const string ExceedsSelfServiceLimit = "SubscriptionIntegration.ExceedsSelfServiceLimit"; } + public static class Synchronize + { + /// EntitySync for AdminUsers is not configured or the delivery configuration is disabled. + public const string EntitySyncForAdminUsersNotEnabled = "Synchronize.EntitySyncForAdminUsersNotEnabled"; + /// 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. + public const string EntitySyncForBuyerNotEnabled = "Synchronize.EntitySyncForBuyerNotEnabled"; + /// EntitySync for BuyerUserGroup is not configured or the delivery configuration is disabled. + public const string EntitySyncForBuyerUserGroupNotEnabled = "Synchronize.EntitySyncForBuyerUserGroupNotEnabled"; + /// EntitySync for BuyerUsers is not configured or the delivery configuration is disabled. + public const string EntitySyncForBuyerUsersNotEnabled = "Synchronize.EntitySyncForBuyerUsersNotEnabled"; + /// EntitySync for InventoryRecords is not configured or the delivery configuration is disabled. + public const string EntitySyncForInventoryRecordNotEnabled = "Synchronize.EntitySyncForInventoryRecordNotEnabled"; + /// EntitySync for Supplier is not configured or the delivery configuration is disabled. + public const string EntitySyncForSupplierNotEnabled = "Synchronize.EntitySyncForSupplierNotEnabled"; + /// EntitySync for SupplierUsers is not configured or the delivery configuration is disabled. + public const string EntitySyncForSupplierUsersNotEnabled = "Synchronize.EntitySyncForSupplierUsersNotEnabled"; + /// ProductSync is not configured or the delivery configuration is disabled. + public const string ProductSyncNotEnabled = "Synchronize.ProductSyncNotEnabled"; + } public static class TrackingEvent { /// Only one TrackingEvent of a given type is permitted for the same ApiClient. diff --git a/src/OrderCloud.SDK/Generated/Models.cs b/src/OrderCloud.SDK/Generated/Models.cs index d3bcefa..133f4c6 100644 --- a/src/OrderCloud.SDK/Generated/Models.cs +++ b/src/OrderCloud.SDK/Generated/Models.cs @@ -1039,7 +1039,7 @@ public class ExtendedOrder : OrderCloudModel public string ID { get => GetProp("ID"); set => SetProp("ID", value); } /// User placing the order. [ApiReadOnly] - public User FromUser { get => GetProp("FromUser"); set => SetProp("FromUser", value); } + public OrderUser FromUser { get => GetProp("FromUser"); set => SetProp("FromUser", value); } /// ID of the Buyer placing the order, or the marketplace owner when an order is being forwarded. Mainly useful to the marketplace owner or supplier receiving it. public string FromCompanyID { get => GetProp("FromCompanyID"); set => SetProp("FromCompanyID", value); } /// ID of the marketplace owner or supplier receiving the order, only writable on create. Mainly useful to the user placing it. @@ -1114,11 +1114,11 @@ public class ExtendedOrder : OrderCloudModel } /// Specific type of the xp property. If not using a custom type, specify dynamic. /// Specific type of the LineItems property. If not using a custom type, specify LineItem. - /// Specific type of the FromUser property. If not using a custom type, specify User. + /// Specific type of the FromUser property. If not using a custom type, specify OrderUser. /// Specific type of the BillingAddress property. If not using a custom type, specify Address. public class ExtendedOrder : ExtendedOrder where TLineItems : LineItem - where TFromUser : User + where TFromUser : OrderUser where TBillingAddress : Address { /// Container for extended (custom) properties of the extended order. @@ -1786,7 +1786,7 @@ public class Order : OrderCloudModel public string ID { get => GetProp("ID"); set => SetProp("ID", value); } /// User placing the order. [ApiReadOnly] - public User FromUser { get => GetProp("FromUser"); set => SetProp("FromUser", value); } + public OrderUser FromUser { get => GetProp("FromUser"); set => SetProp("FromUser", value); } /// ID of the Buyer placing the order, or the marketplace owner when an order is being forwarded. Mainly useful to the marketplace owner or supplier receiving it. public string FromCompanyID { get => GetProp("FromCompanyID"); set => SetProp("FromCompanyID", value); } /// ID of the marketplace owner or supplier receiving the order, only writable on create. Mainly useful to the user placing it. @@ -1860,10 +1860,10 @@ public class Order : OrderCloudModel 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 FromUser property. If not using a custom type, specify User. + /// Specific type of the FromUser property. If not using a custom type, specify OrderUser. /// Specific type of the BillingAddress property. If not using a custom type, specify Address. public class Order : Order - where TFromUser : User + where TFromUser : OrderUser where TBillingAddress : Address { /// Container for extended (custom) properties of the order. @@ -2191,6 +2191,59 @@ public class OrderSyncConfig : OrderCloudModel /// Config data of the order sync config. public object ConfigData { get => GetProp("ConfigData"); set => SetProp("ConfigData", value); } } + public class OrderUser : OrderCloudModel + { + /// ID of the order user. Can only contain characters Aa-Zz, 0-9, -, and _. Searchable: priority level 1. Sortable. + public string ID { get => GetProp("ID"); set => SetProp("ID", value); } + /// ID of the company. + [ApiReadOnly] + public string CompanyID { get => GetProp("CompanyID"); set => SetProp("CompanyID", value); } + /// Must be unique across all organizations. + [Required] + public string Username { get => GetProp("Username"); set => SetProp("Username", value); } + /// Password of the order user. + [ApiWriteOnly] + public string Password { get => GetProp("Password"); set => SetProp("Password", value); } + /// First name of the order user. Required. Max length 100 characters. Searchable: priority level 4. Sortable: priority level 2. + [Required] + public string FirstName { get => GetProp("FirstName"); set => SetProp("FirstName", value); } + /// Last name of the order user. Required. Max length 100 characters. Searchable: priority level 3. Sortable: priority level 1. + [Required] + public string LastName { get => GetProp("LastName"); set => SetProp("LastName", value); } + /// Email of the order user. Required. Max length 200 characters. Searchable: priority level 5. Sortable. + [Required] + public string Email { get => GetProp("Email"); set => SetProp("Email", value); } + /// Phone of the order user. Max length 100 characters. + public string Phone { get => GetProp("Phone"); set => SetProp("Phone", value); } + /// Terms accepted of the order user. + public DateTimeOffset? TermsAccepted { get => GetProp("TermsAccepted"); set => SetProp("TermsAccepted", value); } + /// If false, authentication is prohibited. + [Required] + public bool Active { get => GetProp("Active"); set => SetProp("Active", value); } + /// Container for extended (custom) properties of the order user. + public dynamic xp { get => GetProp("xp", new ExpandoObject()); set => SetProp("xp", value); } + /// List of roles currently available to the user via all security profile assignments. + [ApiReadOnly] + public IReadOnlyList AvailableRoles { get => GetProp>("AvailableRoles"); set => SetProp>("AvailableRoles", value); } + /// Most specific locale assigned to the user, if any. + [ApiReadOnly] + public Locale Locale { get => GetProp("Locale"); set => SetProp("Locale", value); } + /// Date created of the order user. Sortable. + [ApiReadOnly] + public DateTimeOffset? DateCreated { get => GetProp("DateCreated"); set => SetProp("DateCreated", value); } + /// Accurate within a few minutes. Includes impersonation activity. + [ApiReadOnly] + public DateTimeOffset? LastActive { get => GetProp("LastActive"); set => SetProp("LastActive", value); } + /// Can be used in conjunction with SecurityProfile.PasswordConfig to enforce password reset schedules. + [ApiReadOnly] + public DateTimeOffset? PasswordLastSetDate { get => GetProp("PasswordLastSetDate"); set => SetProp("PasswordLastSetDate", value); } + } + /// Specific type of the xp property. If not using a custom type, use the non-generic OrderUser class instead. + public class OrderUser : OrderUser + { + /// Container for extended (custom) properties of the order user. + public new Txp xp { get => GetProp("xp"); set => SetProp("xp", value); } + } public class OrderWorksheet : OrderCloudModel { /// Order of the order worksheet. @@ -3588,6 +3641,9 @@ public class TrackingEvent : OrderCloudModel } public class User : OrderCloudModel { + /// Number of times the user failed authentication due to incorrect password since last successful attempt, or since being unlocked. + [ApiReadOnly] + public int FailedLoginAttempts { get => GetProp("FailedLoginAttempts"); set => SetProp("FailedLoginAttempts", value); } /// ID of the user. Can only contain characters Aa-Zz, 0-9, -, and _. Searchable: priority level 1. Sortable. public string ID { get => GetProp("ID"); set => SetProp("ID", value); } /// ID of the company. @@ -3891,10 +3947,10 @@ public class PartialMeUser : PartialMeUser public class PartialOpenIdConnect : OpenIdConnect, IPartial { } public class PartialOrder : Order, IPartial { } /// Specific type of the xp property. If not using a custom type, specify dynamic. - /// Specific type of the FromUser property. If not using a custom type, specify User. + /// Specific type of the FromUser property. If not using a custom type, specify OrderUser. /// Specific type of the BillingAddress property. If not using a custom type, specify Address. public class PartialOrder : PartialOrder - where TFromUser : User + where TFromUser : OrderUser where TBillingAddress : Address { } public class PartialOrderReturn : OrderReturn, IPartial { } @@ -3903,6 +3959,10 @@ public class PartialOrderReturn : PartialOrderReturn { } public class PartialOrderReturnItem : OrderReturnItem, IPartial { } public class PartialOrderSyncConfig : OrderSyncConfig, IPartial { } + public class PartialOrderUser : OrderUser, IPartial { } + /// Specific type of the xp property. If not using a custom type, use the non-generic PartialOrderUser class instead. + public class PartialOrderUser : PartialOrderUser + { } public class PartialPasswordConfig : PasswordConfig, IPartial { } public class PartialPayment : Payment, IPartial { } /// Specific type of the xp property. If not using a custom type, specify dynamic. diff --git a/src/OrderCloud.SDK/Generated/Resources.cs b/src/OrderCloud.SDK/Generated/Resources.cs index 1f449f8..7e127e1 100644 --- a/src/OrderCloud.SDK/Generated/Resources.cs +++ b/src/OrderCloud.SDK/Generated/Resources.cs @@ -4152,12 +4152,12 @@ public interface IOrdersResource /// Direction of the order, from the current user's perspective. /// 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 CreateAsync(OrderDirection direction, Order order = null, string accessToken = null); + Task CreateAsync(OrderDirection direction, Order order, string accessToken = null); /// Create an order. /// Direction of the order, from the current user's perspective. /// 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 CreateAsync(OrderDirection direction, Order order = null, string accessToken = null) where TOrder : Order; + Task CreateAsync(OrderDirection direction, Order order, string accessToken = null) where TOrder : Order; /// Create or update an order. If an object with the same ID already exists, it will be overwritten. /// Direction of the order, from the current user's perspective. /// ID of the order. @@ -7738,8 +7738,8 @@ internal OrdersResource(OrderCloudClient client) : base(client) { } public Task> ListAsync(OrderDirection direction, string buyerID = null, string supplierID = null, DateTimeOffset? from = null, DateTimeOffset? to = null, string search = null, string searchOn = null, SearchType searchType = SearchType.AnyTerm, string sortBy = null, int page = 1, int pageSize = 20, object filters = null, string accessToken = null) where TOrder : Order => Request("v1", "orders", direction).WithOAuthBearerToken(accessToken).SetQueryParams(new { buyerID, supplierID, from, to, search, searchOn, searchType, sortBy, page, pageSize }).SetQueryParams(filters).GetJsonAsync>(); public Task> ListAsync(OrderDirection direction, Action> buildListOpts, string buyerID = null, string supplierID = null, DateTimeOffset? from = null, DateTimeOffset? to = null, string accessToken = null) => ListAsync(direction, buildListOpts, buyerID, supplierID, from, to, accessToken); public Task> ListAsync(OrderDirection direction, Action> buildListOpts, string buyerID = null, string supplierID = null, DateTimeOffset? from = null, DateTimeOffset? to = null, string accessToken = null) where TOrder : Order => Request("v1", "orders", direction).WithOAuthBearerToken(accessToken).SetQueryParams(new { buyerID, supplierID, from, to }).SetListOptions(buildListOpts).GetJsonAsync>(); - public Task CreateAsync(OrderDirection direction, Order order = null, string accessToken = null) => CreateAsync(direction, order, accessToken); - public Task CreateAsync(OrderDirection direction, Order order = null, string accessToken = null) where TOrder : Order => Request("v1", "orders", direction).WithOAuthBearerToken(accessToken).PostJsonAsync(ValidateModel(order)).ReceiveJson(); + public Task CreateAsync(OrderDirection direction, Order order, string accessToken = null) => CreateAsync(direction, order, accessToken); + public Task CreateAsync(OrderDirection direction, Order order, string accessToken = null) where TOrder : Order => Request("v1", "orders", direction).WithOAuthBearerToken(accessToken).PostJsonAsync(ValidateModel(order)).ReceiveJson(); public Task SaveAsync(OrderDirection direction, string orderID, Order order, string accessToken = null) => SaveAsync(direction, orderID, order, accessToken); public Task SaveAsync(OrderDirection direction, string orderID, Order order, string accessToken = null) where TOrder : Order => Request("v1", "orders", direction, orderID).WithOAuthBearerToken(accessToken).PutJsonAsync(ValidateModel(order)).ReceiveJson(); public Task DeleteAsync(OrderDirection direction, string orderID, string accessToken = null) => Request("v1", "orders", direction, orderID).WithOAuthBearerToken(accessToken).DeleteAsync(); diff --git a/src/OrderCloud.SDK/OrderCloud.SDK.csproj b/src/OrderCloud.SDK/OrderCloud.SDK.csproj index 2ed672e..dd08aa3 100644 --- a/src/OrderCloud.SDK/OrderCloud.SDK.csproj +++ b/src/OrderCloud.SDK/OrderCloud.SDK.csproj @@ -4,7 +4,7 @@ netstandard2.0;net461 True - 0.18.9 + 0.18.10 OrderCloud.SDK OrderCloud SDK Todd Menier