Skip to content

Commit 054350e

Browse files
authored
Merge pull request #5 from Olman62/Editing2
feat: added new library features, examples and tests
2 parents ede9ee5 + 27d7df3 commit 054350e

File tree

189 files changed

+13212
-1191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+13212
-1191
lines changed

route4me-csharp-sdk/Route4MeSDKLibrary/Consts.cs

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,13 @@ public static class R4MEInfrastructureSettingsV5
9292
public const string ApiVersion = "5";
9393

9494
public const string MainHost = "https://wh.route4me.com/modules/api/v5.0";
95+
public const string MainHost51 = "https://wh.route4me.com/modules/api/v5.1";
9596

9697
public const string MainHostWeb = "https://wh.route4me.com/modules/webapi/v5.0";
9798

9899
public const string Routes = MainHost + "/routes";
100+
public const string Routes51 = MainHost51 + "/routes";
101+
99102
public const string RoutesDuplicate = MainHost + "/routes/duplicate";
100103
public const string RoutesMerge = MainHost + "/routes/merge";
101104
public const string RoutesPaginate = MainHost + "/routes/paginate";
@@ -107,6 +110,7 @@ public static class R4MEInfrastructureSettingsV5
107110
public const string RoutesDatatableConfig = MainHost + "/routes/datatable/config";
108111
public const string RoutesDatatableConfigFallback = MainHost + "/routes/fallback/datatable/config";
109112
public const string RouteBreaks = MainHost + "/route-breaks";
113+
public const string RouteAddressDynamicInsert = MainHost + "/routes/lookup-for-new-destination";
110114

111115
public const string TeamUsers = MainHost + "/team/users";
112116

@@ -120,18 +124,40 @@ public static class R4MEInfrastructureSettingsV5
120124

121125
public const string Vehicles = MainHost + "/vehicles";
122126

127+
public const string VehiclePaginated = MainHost + "/vehicles/paginate";
128+
123129
public const string VehicleTemporary = MainHost + "/vehicles/assign";
124130

125131
public const string VehicleExecuteOrder = MainHost + "/vehicles/execute";
126132

127133
public const string VehicleLocation = MainHost + "/vehicles/location";
128134

129-
public const string VehicleProfiles = MainHost + "/vehicle-profiles";
135+
public const string VehicleSyncTelematics = MainHost + "/vehicles/sync/pending";
130136

131137
public const string VehicleLicense = MainHost + "/vehicles/license";
132138

133139
public const string VehicleSearch = MainHost + "/vehicles/search";
134140

141+
142+
public const string VehicleProfiles = MainHost + "/vehicle-profiles";
143+
144+
public const string VehicleCapacityProfiles = MainHost + "/vehicle-capacity-profiles";
145+
146+
147+
public const string VehicleBulkActivate = MainHost + "/vehicles/bulk/activate";
148+
149+
public const string VehicleBulkDeactivate = MainHost + "/vehicles/bulk/deactivate";
150+
151+
public const string VehicleBulkDelete = MainHost + "/vehicles/bulk/delete";
152+
153+
public const string VehicleBulkRestore = MainHost + "/vehicles/bulk/restore";
154+
155+
public const string VehicleBulkUpdate = MainHost + "/vehicles/bulk/update";
156+
157+
public const string VehicleJobResult = MainHost + "/vehicles/job-tracker/result";
158+
159+
public const string VehicleJobStatus = MainHost + "/vehicles/job-tracker/status";
160+
135161
#endregion
136162

137163
#region Telematics Platform
@@ -214,8 +240,8 @@ public static class R4MEInfrastructureSettingsV5
214240
public const string ContactsExport = ContactHost + "/addresses/export";
215241
public const string ContactsExportByAreas = ContactHost + "/addresses/export-by-areas";
216242
public const string ContactsExportByAreaIds = ContactHost + "/addresses/export-by-area-ids";
217-
public const string ContactsGetAsyncJobStatus = ContactHost + "/addresses/job-tracker/status/{job_id}";
218-
public const string ContactsGetAsyncJobResult = ContactHost + "/addresses/job-tracker/result/{job_id}";
243+
public const string ContactsGetAsyncJobStatus = ContactHost + "/job-tracker/status";
244+
public const string ContactsGetAsyncJobResult = ContactHost + "/job-tracker/result";
219245
public const string AddressBookDepots = ContactHost + "/addresses/depots";
220246

221247
#endregion

route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/Enums.cs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,15 @@ public enum TerritoryType : uint
251251
/// <para>Coordinates = 2, group locations by coordinates</para>
252252
/// <para>AddressId = 3, group locations by list of the address IDs</para>
253253
/// <para>Address = 4, group locations by address custom fields</para>
254+
/// <para>MultipleFields = 5, group locations by multiple address fields</para>
254255
/// </summary>
255256
public enum AddressBundlingMode : uint
256257
{
257258
Address = 1,
258259
Coordinates = 2,
259260
AddressId = 3,
260-
AddressCustomField = 4
261+
AddressCustomField = 4,
262+
MultipleFields = 5
261263
}
262264

263265
/// <summary>
@@ -314,4 +316,39 @@ public enum TelematicsVendorType : uint
314316
}
315317

316318
#endregion
319+
320+
/// <summary>
321+
/// Enumeration of the order statuses
322+
/// </summary>
323+
public enum OrderStatuses : uint
324+
{
325+
New = 0,
326+
InboundScan = 1,
327+
SortedByTerritory = 2,
328+
Loaded = 3,
329+
Missing = 4,
330+
Damaged = 5,
331+
ManuallyLoaded = 6,
332+
Routed = 7,
333+
Unrouted = 8,
334+
SortedByRoute = 9,
335+
RouteStarted = 10,
336+
Failed = 11,
337+
Skipped = 12,
338+
Done = 13,
339+
Cancelled = 14,
340+
Scheduled = 15
341+
}
342+
343+
/// <summary>
344+
/// Route balancing modes
345+
/// </summary>
346+
public enum BalanceModes : uint
347+
{
348+
[Description("distance")] Distance,
349+
350+
[Description("time")] Time,
351+
352+
[Description("destinations_count")] DestinationsCount
353+
}
317354
}

route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/OrderCustomField.cs

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Collections.Generic;
2-
using System.Runtime.Serialization;
1+
using System.Runtime.Serialization;
32

43
namespace Route4MeSDK.DataTypes
54
{
@@ -47,11 +46,33 @@ public sealed class OrderCustomField
4746

4847
/// <summary>
4948
/// Information about an order's custom field.
50-
/// You can specify the propertiesof the different types in this property,
49+
/// You can specify the properties of the different types in this property,
5150
/// but the property "short_label" is reserved - it specifies custom field column header
5251
/// in the orders table in the page: https://route4me.com/orders
5352
/// </summary>
5453
[DataMember(Name = "order_custom_field_type_info", EmitDefaultValue = false)]
55-
public Dictionary<string, object> OrderCustomFieldTypeInfo { get; set; }
54+
public CustomOrderTypeInfo OrderCustomFieldTypeInfo { get; set; }
55+
}
56+
57+
[DataContract]
58+
public class CustomOrderTypeInfo
59+
{
60+
/// <summary>
61+
/// Short label.
62+
/// </summary>
63+
[DataMember(Name = "short_label", EmitDefaultValue = false)]
64+
public string ShortLabel { get; set; }
65+
66+
/// <summary>
67+
/// Short caption.
68+
/// </summary>
69+
[DataMember(Name = "short_caption", EmitDefaultValue = false)]
70+
public string ShortCaption { get; set; }
71+
72+
/// <summary>
73+
/// Allowed values.
74+
/// </summary>
75+
[DataMember(Name = "allowed_values", EmitDefaultValue = false)]
76+
public string[] AllowedValues { get; set; }
5677
}
5778
}

route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/RouteParameters.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.ComponentModel;
34
using System.ComponentModel.DataAnnotations;
45
using System.Runtime.Serialization;
@@ -263,8 +264,6 @@ public sealed class RouteParameters
263264
[DataMember(Name = "metric", EmitDefaultValue = false)]
264265
public Metric Metric { get; set; }
265266

266-
//the type of algorithm to use when optimizing the route
267-
268267
/// <summary>
269268
/// The algorithm type to use when optimizing the route. See <see cref="DataTypes.AlgorithmType" />
270269
/// </summary>
@@ -666,6 +665,18 @@ public sealed class RouteParameters
666665
[DataMember(Name = "use_mixed_pickup_delivery_demands", EmitDefaultValue = false)]
667666
[DefaultValue(false)]
668667
public bool UseMixedPickupDeliveryDemands { get; set; }
668+
669+
/// <summary>
670+
/// Route balancing.
671+
/// </summary>
672+
[DataMember(Name = "balance", EmitDefaultValue = false)]
673+
public Balance Balance { get; set; }
674+
675+
/// <summary>
676+
/// Specifies a maximum number of the routes by advanced constraint groups.
677+
/// </summary>
678+
[DataMember(Name = "group_max_routes", EmitDefaultValue = false)]
679+
public List<object[]> GroupMaxRoutes { get; set; }
669680
}
670681

671682
/// <summary>
@@ -729,4 +740,13 @@ public SlowdownParams()
729740
[DataMember(Name = "travel_time", EmitDefaultValue = false)]
730741
public int? TravelTime { get; set; }
731742
}
743+
744+
public class Balance
745+
{
746+
/// <summary>
747+
/// Route balancing modes. <see cref="BalanceModes"/>
748+
/// </summary>
749+
[DataMember(Name = "mode", EmitDefaultValue = false)]
750+
public string Mode { get; set; }
751+
}
732752
}

route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/TimePredictionModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public sealed class TimePredictionModel
1818
/// Time-consuming prediction for an action model.
1919
/// </summary>
2020
[DataMember(Name = "value", EmitDefaultValue = false)]
21-
public long Value { get; set; }
21+
public long? Value { get; set; }
2222

2323
/// <summary>
2424
/// Time unit (e.g. 'seconds', 'minutes')

route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/Address/Address.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,17 @@ public class Address : GenericParameters
2121
[DataMember(Name = "route_destination_id", EmitDefaultValue = false)]
2222
public long? RouteDestinationId { get; set; }
2323

24+
string _alias;
25+
2426
/// <summary>
2527
/// Address alias
2628
/// </summary>
2729
[DataMember(Name = "alias", EmitDefaultValue = false)]
28-
public string Alias { get; set; }
30+
public string Alias
31+
{
32+
get { return _alias; }
33+
set { _alias = value=="" ? null : value; }
34+
}
2935

3036
/// <summary>
3137
/// Member ID
@@ -49,13 +55,13 @@ public class Address : GenericParameters
4955
/// <summary>
5056
/// Route destination address
5157
/// </summary>
52-
[DataMember(Name = "address")]
58+
[DataMember(Name = "address", EmitDefaultValue = false)]
5359
public string AddressString { get; set; }
5460

5561
/// <summary>
5662
/// Route address stop type
5763
/// </summary>
58-
[DataMember(Name = "address_stop_type")]
64+
[DataMember(Name = "address_stop_type", EmitDefaultValue = false)]
5965
public string AddressStopType { get; set; }
6066

6167
/// <summary>
@@ -472,14 +478,14 @@ public class Address : GenericParameters
472478
/// Curbside latitude.
473479
/// Generate optimal routes and driving directions to this curbside latitude.
474480
/// </summary>
475-
[DataMember(Name = "curbside_lat")]
481+
[DataMember(Name = "curbside_lat", EmitDefaultValue = false)]
476482
public double? CurbsideLatitude { get; set; }
477483

478484
/// <summary>
479485
/// Curbside longitude.
480486
/// Generate optimal routes and driving directions to the curbside longitude.
481487
/// </summary>
482-
[DataMember(Name = "curbside_lng")]
488+
[DataMember(Name = "curbside_lng", EmitDefaultValue = false)]
483489
public double? CurbsideLongitude { get; set; }
484490

485491
/// <summary>

route4me-csharp-sdk/Route4MeSDKLibrary/DataTypes/V5/DriverReview.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@
44

55
namespace Route4MeSDK.DataTypes.V5
66
{
7+
/// <summary>
8+
/// The data structure of a driver review response (create, update).
9+
/// </summary>
10+
[DataContract]
11+
public sealed class DriverReviewResponse
12+
{
13+
/// <summary>
14+
/// The data object containing a driver review object.
15+
/// </summary>
16+
[DataMember(Name = "data")]
17+
public DriverReview Data { get; set; }
18+
}
19+
720
/// <summary>
821
/// The data structure of a retrieved driver review.
922
/// </summary>
@@ -46,6 +59,7 @@ public sealed class DriverReview : GenericParameters
4659
/// <summary>
4760
/// The data structure of a retrieved driver reviews list.
4861
/// </summary>
62+
[DataContract]
4963
public sealed class DriverReviewsResponse
5064
{
5165
/// <summary>
@@ -70,6 +84,7 @@ public sealed class DriverReviewsResponse
7084
/// <summary>
7185
/// Data structure of the response pagination info.
7286
/// </summary>
87+
[DataContract]
7388
public sealed class SimplePaginationData
7489
{
7590
/// <summary>
@@ -92,14 +107,15 @@ public sealed class SimplePaginationData
92107

93108
[DataMember(Name = "first")] public string First { get; set; }
94109

95-
[DataMember(Name = "prev")] public int? Previous { get; set; }
110+
[DataMember(Name = "prev")] public string Previous { get; set; }
96111

97-
[DataMember(Name = "next")] public int? Next { get; set; }
112+
[DataMember(Name = "next")] public string Next { get; set; }
98113
}
99114

100115
/// <summary>
101116
/// Driver rating quantity by types.
102117
/// </summary>
118+
[DataContract]
103119
public sealed class TypeQuantity
104120
{
105121
[DataMember(Name = "type")] public int Type { get; set; }

0 commit comments

Comments
 (0)