C# Class Keen.Core.KeenUtil

Mostrar archivo Open project: keenlabs/keen-sdk-net Class Usage Examples

Public Methods

Method Description
CheckApiErrorCode ( dynamic apiResponse ) : void

Check the 'error_code' field and throw the appropriate exception if non-null.

GetBulkApiError ( Newtonsoft.Json.Linq.JObject apiResponse ) : Exception

Check the 'error' field on a bulk insert operation response and return the appropriate exception.

ToSafeString ( this obj ) : string
TryGetDouble ( this s ) : double?
TryGetInt ( this s ) : int?
ValidateEventCollectionName ( string collection ) : void

Apply the collection name restrictions. Throws KeenException with an explanation if a collection name is unacceptable.

ValidatePropertyName ( string property ) : void

Apply property name restrictions. Throws KeenException with an explanation if a collection name is unacceptable.

Private Methods

Method Description
TryUnwrap ( this ex ) : Exception

Flatten an AggregateException and if only one exception instance is found in the innerexceptions, return it, otherwise return the original AggregateException unchanged.

Method Details

CheckApiErrorCode() public static method

Check the 'error_code' field and throw the appropriate exception if non-null.
public static CheckApiErrorCode ( dynamic apiResponse ) : void
apiResponse dynamic Deserialized json response from a Keen API call.
return void

GetBulkApiError() public static method

Check the 'error' field on a bulk insert operation response and return the appropriate exception.
public static GetBulkApiError ( Newtonsoft.Json.Linq.JObject apiResponse ) : Exception
apiResponse Newtonsoft.Json.Linq.JObject Deserialized json response from a Keen API call.
return System.Exception

ToSafeString() public static method

public static ToSafeString ( this obj ) : string
obj this
return string

TryGetDouble() public static method

public static TryGetDouble ( this s ) : double?
s this
return double?

TryGetInt() public static method

public static TryGetInt ( this s ) : int?
s this
return int?

ValidateEventCollectionName() public static method

Apply the collection name restrictions. Throws KeenException with an explanation if a collection name is unacceptable.
public static ValidateEventCollectionName ( string collection ) : void
collection string
return void

ValidatePropertyName() public static method

Apply property name restrictions. Throws KeenException with an explanation if a collection name is unacceptable.
public static ValidatePropertyName ( string property ) : void
property string
return void