@@ -50,6 +50,13 @@ namespace {{packageName}}.Client
5050 AccessToken = accessToken;
5151 UserAgent = userAgent;
5252
53+ ClientId = GetClientId();
54+
55+ if (merchConfigDictObj != null)
56+ {
57+ SolutionId = merchConfigDictObj.ContainsKey(" solutionID" ) ? merchConfigDictObj[" solutionID" ] : null;
58+ }
59+
5360 if (merchConfigDictObj != null)
5461 {
5562 if (bool.Parse(merchConfigDictObj[" useProxy" ])) {
@@ -80,6 +87,15 @@ namespace {{packageName}}.Client
8087 MerchantConfigDictionaryObj = merchConfigDictObj;
8188 }
8289
90+ private string GetClientId()
91+ {
92+ var assembly = typeof(Configuration).Assembly;
93+
94+ var assemblyVersion = AssemblyHelper.GetAssemblyAttribute< AssemblyFileVersionAttribute> (assembly).Version;
95+
96+ return " cybs-rest-sdk-dotnet-" + assemblyVersion;
97+ }
98+
8399 /// <summary >
84100 /// Initializes a new instance of the Configuration class.
85101 /// </summary >
@@ -250,6 +266,18 @@ namespace {{packageName}}.Client
250266 /// <value >The API key.</value >
251267 public Dictionary<String , String > ApiKey = new Dictionary<String , String >();
252268
269+ /// <summary >
270+ /// Gets or sets the Client ID for SDK auditing and/or reporting.
271+ /// </summary >
272+ /// <value >The Client ID.</value >
273+ public String ClientId { get; set; }
274+
275+ /// <summary >
276+ /// Gets or sets the Solution ID for SDK auditing and/or reporting.
277+ /// </summary >
278+ /// <value >The Solution ID.</value >
279+ public String SolutionId { get; set; }
280+
253281 /// <summary >
254282 /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
255283 /// </summary >
@@ -373,4 +401,15 @@ namespace {{packageName}}.Client
373401 return report;
374402 }
375403 }
404+
405+ public static class AssemblyHelper
406+ {
407+ public static T GetAssemblyAttribute< T> (this System.Reflection.Assembly ass) where T : Attribute
408+ {
409+ object[] attributes = ass.GetCustomAttributes(typeof(T), false );
410+ if (attributes == null || attributes.Length == 0)
411+ return null;
412+ return attributes.OfType< T> ().SingleOrDefault();
413+ }
414+ }
376415}
0 commit comments