Class KraangRequestPayloadFormatter
Formats data in an acceptable manner for Kraang analytics requests, including payload signatures.
Inheritance
KraangRequestPayloadFormatter
Assembly: cs.temp.dll.dll
public class KraangRequestPayloadFormatter : IInjectable
Fields
Declaration
protected IActionService _actionService
Field Value
Type |
Description |
IActionService |
|
Declaration
Field Value
Declaration
protected IAppInformation _appInformation
Field Value
Type |
Description |
IAppInformation |
|
Declaration
protected KraangAuthenticator _authenticator
Field Value
Declaration
protected string _platform
Field Value
Declaration
protected string _signingSecret
Field Value
Declaration
protected string _version
Field Value
Declaration
public const string APP_ID_KEY = "app"
Field Value
Declaration
public const string APP_VERSION_KEY = "version"
Field Value
Declaration
public const string PLATFORM_KEY = "platform"
Field Value
Declaration
public const string SIGNATURE_KEY = "signature"
Field Value
Methods
Batched Events are flattened into a JSON array of objects.
Declaration
protected virtual string FormatBatchedEventDatas(List<Dictionary<string, object>> nestedEventDatas)
Parameters
Type |
Name |
Description |
List<Dictionary<String, Object>> |
nestedEventDatas |
|
Returns
Format all event data into string keys and values.
Declaration
public virtual Hashtable FormatData(Dictionary<string, object> eventData, bool forceNoEscape = false)
Parameters
Returns
Type |
Description |
Hashtable |
|
Returns data as a simple a JSON object.
Declaration
protected virtual string FormatNestedData(Hashtable data, bool forceNoEscape)
Parameters
Type |
Name |
Description |
Hashtable |
data |
The data to format.
|
Boolean |
forceNoEscape |
If true, quotes in the data will not be escaped.
|
Returns
Declaration
public void Initialize(string appId, string signingSecret)
Parameters
Declaration
public void Inject(IResolver resolver)
Parameters
Type |
Name |
Description |
IResolver |
resolver |
|
Adds data that every event needs.
Declaration
public virtual void InjectCommonData(IDictionary eventData)
Parameters
Type |
Name |
Description |
IDictionary |
eventData |
The event data to add data to.
|
Create a signature using sourceData
and store that
signature into targetData
.
Declaration
public virtual void SignEventData(IDictionary sourceData, IDictionary targetData = null)
Parameters
Type |
Name |
Description |
IDictionary |
sourceData |
The payload data used to generate a signature.
|
IDictionary |
targetData |
The payload to write the signature into.
|