diff --git a/route4me-csharp-sdk/Route4MeSDKLibrary/Consts.cs b/route4me-csharp-sdk/Route4MeSDKLibrary/Consts.cs index b0a91d2e..107b9f43 100644 --- a/route4me-csharp-sdk/Route4MeSDKLibrary/Consts.cs +++ b/route4me-csharp-sdk/Route4MeSDKLibrary/Consts.cs @@ -290,6 +290,11 @@ public static class R4MEInfrastructureSettingsV5 public const string Workflows = MainHost + "/workflows"; #endregion + #region Optimization Profiles + public const string OptimizationProfiles = MainHost + "/optimization-profiles"; + public const string OptimizationProfilesList = OptimizationProfiles + "/list"; + #endregion + #endregion } } \ No newline at end of file diff --git a/route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/RouteParameters.cs b/route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/RouteParameters.cs index c817ae0d..8ca03596 100644 --- a/route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/RouteParameters.cs +++ b/route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/RouteParameters.cs @@ -677,6 +677,12 @@ public sealed class RouteParameters /// [DataMember(Name = "group_max_routes", EmitDefaultValue = false)] public List GroupMaxRoutes { get; set; } + + /// + /// Route start date local + /// + [DataMember(Name = "route_start_date_local", EmitDefaultValue = false)] + public string RouteStartDateLocal { get; set; } } /// diff --git a/route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/OptimizationProfiles/OptimizationProfile.cs b/route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/OptimizationProfiles/OptimizationProfile.cs new file mode 100644 index 00000000..c833b855 --- /dev/null +++ b/route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/OptimizationProfiles/OptimizationProfile.cs @@ -0,0 +1,29 @@ +using System.Runtime.Serialization; + +namespace Route4MeSDKLibrary.DataTypes.V5.OptimizationProfiles +{ + /// + /// Optimization profile + /// + [DataContract] + public class OptimizationProfile + { + /// + /// Optimization profile ID + /// + [DataMember(Name = "optimization_profile_id", EmitDefaultValue = false)] + public string Id { get; set; } + + /// + /// Profile name + /// + [DataMember(Name = "profile_name", EmitDefaultValue = false)] + public string Name { get; set; } + + /// + /// Is default + /// + [DataMember(Name = "is_default", EmitDefaultValue = false)] + public bool IsDefault { get; set; } + } +} \ No newline at end of file diff --git a/route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/OptimizationProfiles/OptimizationProfilesResponse.cs b/route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/OptimizationProfiles/OptimizationProfilesResponse.cs new file mode 100644 index 00000000..6c7a3689 --- /dev/null +++ b/route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/OptimizationProfiles/OptimizationProfilesResponse.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; + +namespace Route4MeSDKLibrary.DataTypes.V5.OptimizationProfiles +{ + /// + /// Optimization profiles response + /// + [DataContract] + public class OptimizationProfilesResponse + { + /// + /// Optimization profiles + /// + [DataMember(Name = "items", EmitDefaultValue = false)] + public OptimizationProfile[] Items { get; set; } + } +} diff --git a/route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/Routes/RouteParameters.cs b/route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/Routes/RouteParameters.cs index 8a249499..3ddfeb3a 100644 --- a/route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/Routes/RouteParameters.cs +++ b/route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/Routes/RouteParameters.cs @@ -648,6 +648,12 @@ public class RouteParameters /// [DataMember(Name = "group_max_routes", EmitDefaultValue = false)] public List GroupMaxRoutes { get; set; } + + /// + /// Route start date local + /// + [DataMember(Name = "route_start_date_local", EmitDefaultValue = false)] + public string RouteStartDateLocal { get; set; } } /// diff --git a/route4me-csharp-sdk/Route4MeSDKLibrary/Managers/OptimizationProfileManagerV5.cs b/route4me-csharp-sdk/Route4MeSDKLibrary/Managers/OptimizationProfileManagerV5.cs new file mode 100644 index 00000000..81fe0ff1 --- /dev/null +++ b/route4me-csharp-sdk/Route4MeSDKLibrary/Managers/OptimizationProfileManagerV5.cs @@ -0,0 +1,47 @@ +using Route4MeSDK.DataTypes.V5; +using Route4MeSDK; +using System.Threading.Tasks; +using System; +using Route4MeSDK.QueryTypes; +using Route4MeSDKLibrary.DataTypes.V5.OptimizationProfiles; + +namespace Route4MeSDKLibrary.Managers +{ + public class OptimizationProfileManagerV5 : Route4MeManagerBase + { + public OptimizationProfileManagerV5(string apiKey) : base(apiKey) + { + } + + /// + /// Get Optimization profiles + /// + /// Failed response + /// List of optimization profiles + public OptimizationProfilesResponse GetOptimizationProfiles(out ResultResponse resultResponse) + { + var response = GetJsonObjectFromAPI(new GenericParameters(), + R4MEInfrastructureSettingsV5.OptimizationProfilesList, + HttpMethodType.Get, false, true, + out resultResponse); + + return response; + } + + /// + /// Get Optimization profiles + /// + /// List of optimization profiles + public async Task> GetPodWorkflowsAsync() + { + var result = await GetJsonObjectFromAPIAsync(new GenericParameters(), + R4MEInfrastructureSettingsV5.OptimizationProfilesList, + HttpMethodType.Get, + null, + true, + false).ConfigureAwait(false); + + return new Tuple(result.Item1, result.Item2); + } + } +} diff --git a/route4me-csharp-sdk/Route4MeSDKLibrary/QueryTypes/OptimizationParameters.cs b/route4me-csharp-sdk/Route4MeSDKLibrary/QueryTypes/OptimizationParameters.cs index d0047257..f7fff503 100644 --- a/route4me-csharp-sdk/Route4MeSDKLibrary/QueryTypes/OptimizationParameters.cs +++ b/route4me-csharp-sdk/Route4MeSDKLibrary/QueryTypes/OptimizationParameters.cs @@ -157,5 +157,11 @@ public sealed class OptimizationParameters : GenericParameters /// [DataMember(Name = "order_territories")] public OrderTerritories OrderTerritories { get; set; } + + /// + /// Optimization profile ID + /// + [DataMember(Name = "optimization_profile_id", EmitDefaultValue = false)] + public string OptimizationProfileId { get; set; } } } \ No newline at end of file diff --git a/route4me-csharp-sdk/Route4MeSDKLibrary/QueryTypes/V5/OptimizationParameters.cs b/route4me-csharp-sdk/Route4MeSDKLibrary/QueryTypes/V5/OptimizationParameters.cs index 9e3fdaa1..25581de9 100644 --- a/route4me-csharp-sdk/Route4MeSDKLibrary/QueryTypes/V5/OptimizationParameters.cs +++ b/route4me-csharp-sdk/Route4MeSDKLibrary/QueryTypes/V5/OptimizationParameters.cs @@ -113,5 +113,11 @@ public sealed class OptimizationParameters : GenericParameters /// [DataMember(Name = "depots", EmitDefaultValue = false)] public Address[] Depots { get; set; } + + /// + /// Optimization profile ID + /// + [DataMember(Name = "optimization_profile_id", EmitDefaultValue = false)] + public string OptimizationProfileId { get; set; } } } \ No newline at end of file diff --git a/route4me-csharp-sdk/Route4MeSDKTest/Examples/OptimizationProfiles/GetOptimizationProfiles.cs b/route4me-csharp-sdk/Route4MeSDKTest/Examples/OptimizationProfiles/GetOptimizationProfiles.cs new file mode 100644 index 00000000..8d83a51a --- /dev/null +++ b/route4me-csharp-sdk/Route4MeSDKTest/Examples/OptimizationProfiles/GetOptimizationProfiles.cs @@ -0,0 +1,14 @@ +using Route4MeSDKLibrary.Managers; + +namespace Route4MeSDK.Examples +{ + public sealed partial class Route4MeExamples + { + public void GetOptimizationProfiles() + { + var route4Me = new OptimizationProfileManagerV5(ActualApiKey); + + var optimizationProfiles = route4Me.GetOptimizationProfiles(out _); + } + } +} diff --git a/route4me-csharp-sdk/Route4MeSDKTest/Program.cs b/route4me-csharp-sdk/Route4MeSDKTest/Program.cs index 8db5f8a1..db018b17 100644 --- a/route4me-csharp-sdk/Route4MeSDKTest/Program.cs +++ b/route4me-csharp-sdk/Route4MeSDKTest/Program.cs @@ -422,6 +422,12 @@ static void Main(string[] args) #endregion + #region Optimization Profiles + + examples.GetOptimizationProfiles(); + + #endregion + #endregion } else // for a specifed example method diff --git a/route4me-csharp-sdk/Route4MeSdkV5UnitTest/V5/OptimizationProfiles/OptimizationProfileManagerV5Tests.cs b/route4me-csharp-sdk/Route4MeSdkV5UnitTest/V5/OptimizationProfiles/OptimizationProfileManagerV5Tests.cs new file mode 100644 index 00000000..c57cac30 --- /dev/null +++ b/route4me-csharp-sdk/Route4MeSdkV5UnitTest/V5/OptimizationProfiles/OptimizationProfileManagerV5Tests.cs @@ -0,0 +1,22 @@ +using NUnit.Framework; +using Route4MeSDKLibrary.DataTypes.V5.OptimizationProfiles; +using Route4MeSDKLibrary.Managers; + +namespace Route4MeSdkV5UnitTest.V5.OptimizationProfiles +{ + [TestFixture] + public class OptimizationProfileManagerV5Tests + { + private static readonly string CApiKey = ApiKeys.ActualApiKey; + + [Test] + public void GetPodWorkflowsTest() + { + var route4Me = new OptimizationProfileManagerV5(CApiKey); + + var optimizationProfiles = route4Me.GetOptimizationProfiles(out _); + + Assert.That(optimizationProfiles.GetType(), Is.EqualTo(typeof(OptimizationProfilesResponse))); + } + } +}