Skip to content

Commit

Permalink
Fixes for AVS and DEVPORT-764 (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
avasachinbaijal authored Dec 14, 2021
1 parent 1eca8ff commit 879be00
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/AvaTaxClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public partial class AvaTaxClient
/// Tracks the amount of time spent on the most recent API call
/// </summary>
public CallDuration LastCallTime { get; set; }
/// <summary>
/// Client Id - passed in request header
/// </summary>
public readonly string ClientID;

/// <summary>
/// Returns the version of the SDK that was compiled
Expand Down Expand Up @@ -62,6 +66,7 @@ public partial class AvaTaxClient
/// <param name="userConfiguration">User configuration</param>
public AvaTaxClient(string appName, string appVersion, string machineName, AvaTaxEnvironment environment, UserConfiguration userConfiguration = null)
{
ClientID= String.Format("{0}; {1}; {2}; {{0}}; {3}", appName, appVersion, "CSharpRestClient", machineName);
// Redo the client identifier
WithClientIdentifier(appName, appVersion, machineName);
if (userConfiguration != null)
Expand All @@ -87,6 +92,7 @@ public AvaTaxClient(string appName, string appVersion, string machineName, AvaTa
/// <param name="userConfiguration">User configuration</param>
public AvaTaxClient(string appName, string appVersion, string machineName, Uri customEnvironment, UserConfiguration userConfiguration = null)
{
ClientID = String.Format("{0}; {1}; {2}; {{0}}; {3}", appName, appVersion, "CSharpRestClient", machineName);
// Redo the client identifier
WithClientIdentifier(appName, appVersion, machineName);
if (userConfiguration != null)
Expand Down Expand Up @@ -176,7 +182,14 @@ public AvaTaxClient WithCustomHeader(string name, string value)
/// <returns></returns>
public AvaTaxClient WithClientIdentifier(string appName, string appVersion, string machineName)
{
_clientHeaders.Add(Constants.AVALARA_CLIENT_HEADER, String.Format("{0}; {1}; {2}; {3}; {4}", appName, appVersion, "CSharpRestClient", API_VERSION, machineName));
if (!_clientHeaders.ContainsKey(Constants.AVALARA_CLIENT_HEADER))
{
_clientHeaders.Add(Constants.AVALARA_CLIENT_HEADER, ClientID);
}
else
{
_clientHeaders[Constants.AVALARA_CLIENT_HEADER] = ClientID;
}
return this;
}
#endregion
Expand Down

0 comments on commit 879be00

Please sign in to comment.