Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
removes reflection based client type identification, adds optional "d…
Browse files Browse the repository at this point in the history
…ocumentType" in all constructors, etc.
  • Loading branch information
didimitrie committed Sep 5, 2019
1 parent ad891ee commit e79bf35
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions ApiClient/SpeckleApiClientExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public partial class SpeckleApiClient : ISerializable
// stores the client type: Grasshopper, Revit, etc.
public string ClientType { get; set; }

public SpeckleApiClient( string baseUrl, bool isPersistent = false )
public SpeckleApiClient( string baseUrl, bool isPersistent = false, string documentType = "unknown" )
{
ClientType = System.Reflection.Assembly.GetCallingAssembly().GetName().Name;
ClientType = documentType;

SetSerialisationSettings();

Expand All @@ -72,9 +72,9 @@ public SpeckleApiClient( string baseUrl, bool isPersistent = false )
SetReadyTimer();
}

public SpeckleApiClient( bool useGzip = true )
public SpeckleApiClient( bool useGzip = true, string documentType = "unknown" )
{
ClientType = System.Reflection.Assembly.GetCallingAssembly().GetName().Name;
ClientType = documentType;
SetSerialisationSettings();
UseGzip = useGzip;
}
Expand Down Expand Up @@ -110,7 +110,7 @@ private void SetSerialisationSettings()
/// <returns></returns>
public async Task IntializeReceiver( string streamId, string documentName, string documentType, string documentGuid, string authToken = null )
{
ClientType = System.Reflection.Assembly.GetCallingAssembly().GetName().Name;
ClientType = documentType;

if ( Role != null )
throw new Exception( "Role changes are not permitted. Maybe create a new client?" );
Expand Down Expand Up @@ -151,7 +151,7 @@ public async Task IntializeReceiver( string streamId, string documentName, strin
/// <returns></returns>
public async Task<string> IntializeSender( string authToken, string documentName, string documentType, string documentGuid )
{
ClientType = System.Reflection.Assembly.GetCallingAssembly().GetName().Name;
ClientType = documentType;

if ( Role != null )
throw new Exception( "Role changes are not permitted. Maybe create a new client?" );
Expand Down Expand Up @@ -182,7 +182,6 @@ public async Task<string> IntializeSender( string authToken, string documentName
catch( SpeckleException e )
{
OnError?.Invoke( this, new SpeckleEventArgs() { EventName = e.StatusCode.ToString(), EventData = e.Message } );

return null;
}

Expand Down

0 comments on commit e79bf35

Please sign in to comment.