Skip to content

Commit 2cf63c7

Browse files
committed
update c# sdk (.net core)
1 parent cde95c1 commit 2cf63c7

16 files changed

+757
-179
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public sealed class AddressCustomNote
1212
/// A unique ID (40 chars) of a custom note entry.
1313
/// </summary>
1414
[DataMember(Name = "note_custom_entry_id", EmitDefaultValue = false)]
15-
public int NoteCustomEntryID { get; set; }
15+
public string NoteCustomEntryID { get; set; }
1616

1717
/// <summary>
1818
/// The custom note ID.
@@ -24,7 +24,7 @@ public sealed class AddressCustomNote
2424
/// The custom note type ID.
2525
/// </summary>
2626
[DataMember(Name = "note_custom_type_id", EmitDefaultValue = false)]
27-
public int NoteCustomTypeID { get; set; }
27+
public string NoteCustomTypeID { get; set; }
2828

2929
/// <summary>
3030
/// The custom note value.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,5 @@ public sealed class AddressNote
9292
/// </summary>
9393
[DataMember(Name = "custom_types")]
9494
public AddressCustomNote[] CustomTypes { get; set; }
95-
9695
}
9796
}

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ namespace Route4MeSDK.DataTypes
1212
/// </summary>
1313
public class Route4MeDynamicClass : DynamicObject
1414
{
15+
private readonly Dictionary<string, object> _dynamicProperties = new Dictionary<string, object>();
16+
1517
/// <summary>
1618
/// Tries to set member
1719
/// </summary>
@@ -20,7 +22,7 @@ public class Route4MeDynamicClass : DynamicObject
2022
/// <returns>True, if a member binded successfully</returns>
2123
public override bool TrySetMember(SetMemberBinder binder, object value)
2224
{
23-
DynamicProperties.Add(binder.Name, value);
25+
_dynamicProperties.Add(binder.Name, value);
2426

2527
// additional error checking code omitted
2628

@@ -30,12 +32,15 @@ public override bool TrySetMember(SetMemberBinder binder, object value)
3032
/// <summary>
3133
/// Getter of the dynamic properties
3234
/// </summary>
33-
public Dictionary<string, object> DynamicProperties { get; } = new Dictionary<string, object>();
35+
public Dictionary<string, object> DynamicProperties
36+
{
37+
get { return _dynamicProperties; }
38+
}
3439

3540

3641
public override bool TryGetMember(GetMemberBinder binder, out object result)
3742
{
38-
return DynamicProperties.TryGetValue(binder.Name, out result);
43+
return _dynamicProperties.TryGetValue(binder.Name, out result);
3944
}
4045

4146
/// <summary>
@@ -46,7 +51,7 @@ public override string ToString()
4651
{
4752
var sb = new StringBuilder();
4853

49-
foreach (var property in DynamicProperties)
54+
foreach (var property in _dynamicProperties)
5055
{
5156
sb.AppendLine($"Property '{property.Key}' = '{property.Value}'");
5257
}
@@ -77,8 +82,8 @@ public void CopyPropertiesFromClass(object r4mObject, List<string> propertyNames
7782

7883
if (typedValue == "IgnoreDataMemberAttribute") continue;
7984

80-
if (!DynamicProperties.ContainsKey(typedValue))
81-
DynamicProperties.Add(typedValue, r4mObject.GetType().GetProperty(propertyName).GetValue(r4mObject));
85+
if (!_dynamicProperties.ContainsKey(typedValue))
86+
_dynamicProperties.Add(typedValue, r4mObject.GetType().GetProperty(propertyName).GetValue(r4mObject));
8287
}
8388
}
8489
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public sealed class RouteParameters
234234
/// Specify the ip address of the remote user making this optimization request.
235235
/// </summary>
236236
[DataMember(Name = "ip", EmitDefaultValue = false)]
237-
public long Ip { get; set; }
237+
public long? Ip { get; set; }
238238

239239
/// <summary>
240240
/// The method to use when compute the distance between the points in a route.

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

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace Route4MeSDK.QueryTypes
1+
using System.Collections.Generic;
2+
3+
namespace Route4MeSDK.QueryTypes
24
{
35
/// <summary>
46
/// Parameters for the address note(s) request.
@@ -52,23 +54,38 @@ public NoteParameters()
5254
[HttpQueryMemberAttribute(Name = "device_type")]
5355
public string DeviceType { get; set; }
5456

57+
/// <summary>
58+
/// Response format.
59+
/// <para>Available values:</para>
60+
/// <value>json, xml</value>,
61+
/// </summary>
62+
[HttpQueryMemberAttribute(Name = "format")]
63+
public string Format { get; set; }
64+
5565
/// <summary>
5666
/// Update type of a note file.
5767
/// <para>Available values:</para>
5868
/// <value>'DRIVER_IMG', 'VEHICLE_IMG', 'ADDRESS_IMG', 'CSV_FILE', 'XLS_FILE', 'ANY_FILE'</value>,
5969
/// </summary>
60-
[HttpQueryMemberAttribute(Name = "strUpdateType")]
6170
public string ActivityType { get; set; }
6271

6372
/// <summary>
64-
/// Response format.
65-
/// <para>Available values:</para>
66-
/// <value>json, xml</value>,
73+
/// Text content of the note.
74+
/// API equivalent: strNoteContents.
6775
/// </summary>
68-
[HttpQueryMemberAttribute(Name = "format")]
69-
public string Format { get; set; }
76+
public string StrNoteContents { get; set; }
7077

71-
//[HttpQueryMemberAttribute(Name = "strNoteContents", EmitDefaultValue = false)]
72-
//public string StrNoteContents { get; set; }
78+
/// <summary>
79+
/// A temporary filename of a prepared for uploading file.
80+
/// API equivalent: strFileName.
81+
/// </summary>
82+
public string StrFileName { get; set; }
83+
84+
/// <summary>
85+
/// Form data parameter.
86+
/// Example item: "custom_note_type[412]": "do a service",
87+
/// where 412 is "note_custom_type_id"
88+
/// </summary>
89+
public Dictionary<string, string> CustomNoteTypes { get; set; }
7390
}
7491
}

0 commit comments

Comments
 (0)