-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dmitry Koval
authored and
Dmitry Koval
committed
Jan 15, 2024
1 parent
bf9283c
commit c114540
Showing
11 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...me-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/OptimizationProfiles/OptimizationProfile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace Route4MeSDKLibrary.DataTypes.V5.OptimizationProfiles | ||
{ | ||
/// <summary> | ||
/// Optimization profile | ||
/// </summary> | ||
[DataContract] | ||
public class OptimizationProfile | ||
{ | ||
/// <summary> | ||
/// Optimization profile ID | ||
/// </summary> | ||
[DataMember(Name = "optimization_profile_id", EmitDefaultValue = false)] | ||
public string Id { get; set; } | ||
|
||
/// <summary> | ||
/// Profile name | ||
/// </summary> | ||
[DataMember(Name = "profile_name", EmitDefaultValue = false)] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Is default | ||
/// </summary> | ||
[DataMember(Name = "is_default", EmitDefaultValue = false)] | ||
public bool IsDefault { get; set; } | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...-sdk/Route4MeSDKLibrary/DataTypes/V5/OptimizationProfiles/OptimizationProfilesResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace Route4MeSDKLibrary.DataTypes.V5.OptimizationProfiles | ||
{ | ||
/// <summary> | ||
/// Optimization profiles response | ||
/// </summary> | ||
[DataContract] | ||
public class OptimizationProfilesResponse | ||
{ | ||
/// <summary> | ||
/// Optimization profiles | ||
/// </summary> | ||
[DataMember(Name = "items", EmitDefaultValue = false)] | ||
public OptimizationProfile[] Items { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
route4me-csharp-sdk/Route4MeSDKLibrary/Managers/OptimizationProfileManagerV5.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Get Optimization profiles | ||
/// </summary> | ||
/// <param name="resultResponse">Failed response</param> | ||
/// <returns>List of optimization profiles</returns> | ||
public OptimizationProfilesResponse GetOptimizationProfiles(out ResultResponse resultResponse) | ||
{ | ||
var response = GetJsonObjectFromAPI<OptimizationProfilesResponse>(new GenericParameters(), | ||
R4MEInfrastructureSettingsV5.OptimizationProfilesList, | ||
HttpMethodType.Get, false, true, | ||
out resultResponse); | ||
|
||
return response; | ||
} | ||
|
||
/// <summary> | ||
/// Get Optimization profiles | ||
/// </summary> | ||
/// <returns>List of optimization profiles</returns> | ||
public async Task<Tuple<OptimizationProfilesResponse, ResultResponse>> GetPodWorkflowsAsync() | ||
{ | ||
var result = await GetJsonObjectFromAPIAsync<OptimizationProfilesResponse>(new GenericParameters(), | ||
R4MEInfrastructureSettingsV5.OptimizationProfilesList, | ||
HttpMethodType.Get, | ||
null, | ||
true, | ||
false).ConfigureAwait(false); | ||
|
||
return new Tuple<OptimizationProfilesResponse, ResultResponse>(result.Item1, result.Item2); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
route4me-csharp-sdk/Route4MeSDKTest/Examples/OptimizationProfiles/GetOptimizationProfiles.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 _); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...rp-sdk/Route4MeSdkV5UnitTest/V5/OptimizationProfiles/OptimizationProfileManagerV5Tests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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))); | ||
} | ||
} | ||
} |