Skip to content

Commit 8c33fea

Browse files
committed
update c# SDK (.net core 3.1)
1 parent b105d4e commit 8c33fea

File tree

22 files changed

+57
-37
lines changed

22 files changed

+57
-37
lines changed

route4me-csharp-sdk/Route4MeSDKLibrary/QueryTypes/OrderFilterParameters.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,17 @@ public class FilterDetails : GenericParameters
5151
/// </summary>
5252
[DataMember(Name = "tracking_numbers")]
5353
public string[] TrackingNumbers { get; set; }
54+
55+
/// <summary>
56+
/// Start of a time range to filter the orders.
57+
/// </summary>
58+
[DataMember(Name = "created_timestamp_start")]
59+
public long? CreatedTimestampStart { get; set; }
60+
61+
/// <summary>
62+
/// Start of a time range to filter the orders.
63+
/// </summary>
64+
[DataMember(Name = "created_timestamp_end")]
65+
public long? CreatedTimestampEnd { get; set; }
5466
}
5567
}

route4me-csharp-sdk/Route4MeSDKLibrary/Utils.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,5 +828,19 @@ public static int GetLocalTimeZone()
828828

829829
return seconds;
830830
}
831+
832+
/// <summary>
833+
/// Generate random string with a specified length from specified source string.
834+
/// </summary>
835+
/// <param name="length">Length of the generated random string</param>
836+
/// <param name="sourceString">Source string. Default: 'ABCDEF0123456789'</param>
837+
/// <returns></returns>
838+
public static string GenerateRandomString(int length, string sourceString= "ABCDEF0123456789")
839+
{
840+
var random = new Random();
841+
842+
return new string(Enumerable.Repeat(sourceString, length)
843+
.Select(s => s[random.Next(s.Length)]).ToArray());
844+
}
831845
}
832846
}

route4me-csharp-sdk/Route4MeSDKTest/Examples/Orders/AddOrderWithTrackingNumber.cs renamed to route4me-csharp-sdk/Route4MeSDKTest/Examples/Orders/AddOrderWithOrderType.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,21 @@ namespace Route4MeSDK.Examples
44
{
55
public sealed partial class Route4MeExamples
66
{
7-
public void AddOrderWithTrackingNumber()
7+
/// <summary>
8+
/// The example demonstrates the process of creating an order with the specified tracking number and address stop type.
9+
/// </summary>
10+
public void AddOrderWithOrderType()
811
{
912
// Create the manager with the api key
1013
var route4Me = new Route4MeManager(ActualApiKey);
1114

15+
// Using of an existing tracking number raises error
16+
var randomTrackingNumber = R4MeUtils.GenerateRandomString(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
17+
1218
var order = new Order()
1319
{
1420
Address1 = "201 LAVACA ST APT 746, AUSTIN, TX, 78701, US",
15-
TrackingNumber = "AA11ZZCC",
21+
TrackingNumber = randomTrackingNumber,
1622
AddressStopType = AddressStopType.PickUp.Description()
1723
};
1824

route4me-csharp-sdk/Route4MeSDKTest/Examples/RouteExamples/OptimizationByOrderTerritories.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ public void OptimizationByOrderTerritories()
2626
VehicleId = ""
2727
};
2828

29+
var depots = new Address[1]
30+
{
31+
new Address()
32+
{
33+
Alias = "HQ1",
34+
AddressString = "1010 N Florida ave, Tampa, FL",
35+
IsDepot = true,
36+
Latitude = 27.952941,
37+
Longitude = -82.459493,
38+
Time = 0
39+
}
40+
};
41+
2942
var orderTerritories = new OrderTerritories()
3043
{
3144
SplitTerritories = true,
@@ -45,7 +58,8 @@ public void OptimizationByOrderTerritories()
4558
{
4659
Redirect = false,
4760
OrderTerritories = orderTerritories,
48-
Parameters = parameters
61+
Parameters = parameters,
62+
Depots = depots
4963
};
5064

5165
// Run the query

route4me-csharp-sdk/Route4MeSDKTest/Program.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
using Route4MeSDK.DataTypes;
2-
using Route4MeSDK.Examples;
1+
using Route4MeSDK.Examples;
32
using System;
4-
using System.Collections.Generic;
53

64
namespace Route4MeSDKTest
75
{
@@ -15,7 +13,7 @@ static void Main(string[] args)
1513
// "api4" - execute all the examples related to the API 4
1614
// "api5" - execute all the examples related to the API 5
1715
// a method name - execute a specifed example method (e.g. "GetTeamMemberById")
18-
string executeOption = "OptimizationByOrderTerritories";
16+
string executeOption = "AddOrderWithOrderType";
1917
//object[] executeParams = new object[] { null };
2018
object[] executeParams = null;
2119

@@ -416,9 +414,9 @@ static void Main(string[] args)
416414
}
417415
}
418416

419-
System.Console.WriteLine("");
420-
System.Console.WriteLine("Press any key");
421-
System.Console.ReadKey();
417+
Console.WriteLine("");
418+
Console.WriteLine("Press any key");
419+
Console.ReadKey();
422420
}
423421
}
424422
}
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)