本文整理汇总了C#中Keen.Core.KeenClient.Query方法的典型用法代码示例。如果您正苦于以下问题:C# KeenClient.Query方法的具体用法?C# KeenClient.Query怎么用?C# KeenClient.Query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Keen.Core.KeenClient
的用法示例。
在下文中一共展示了KeenClient.Query方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main (string[] args)
{
// Loading Keen.IO Keys and Misc. from Config File
_keenIOProjectID = ConfigurationManager.AppSettings["keenIOProjectID"];
_keenIOMasterKey = ConfigurationManager.AppSettings["keenIOMasterKey"];
_keenIOWriteKey = ConfigurationManager.AppSettings["keenIOWriteKey"];
_keenIOReadKey = ConfigurationManager.AppSettings["keenIOReadKey"];
_bucketName = ConfigurationManager.AppSettings["keenIOBucketName"];
// Creating Keen.IO Variables - Yes, i am setting my read key as the master key, so that you can read the bucket I have created with data
var projectSettings = new ProjectSettingsProvider (_keenIOProjectID,masterKey:_keenIOReadKey);
var keenClient = new KeenClient (projectSettings);
/*********************************************************************
* EXECUTING SIMPLE ANALYTICS QUERIES ON KEEN.IO
**********************************************************************/
// Query 1 - Average App Price grouped by Category
Dictionary<String,String> parameters = new Dictionary<String,String>();
parameters.Add ("event_collection", "PlayStore2014");
parameters.Add ("target_property", "Price");
parameters.Add ("group_by", "Category");
JObject keenResponse = keenClient.Query (KeenConstants.QueryAverage, parameters);
PrintQueryTitle ("Query 1 - Average App Price grouped by Category");
Console.WriteLine (keenResponse.ToSafeString ());
PrintSeparator ();
// Query 2 - Most Expensive app for sale of each category
keenResponse = keenClient.Query (KeenConstants.QueryMaximum, parameters);
PrintQueryTitle ("Query 2 - Most Expensive app for sale of each category");
Console.WriteLine (keenResponse.ToSafeString ());
PrintSeparator ();
// Query 3 - Most Expensive App for sale of all (without group by)
parameters.Remove ("group_by");
keenResponse = keenClient.Query (KeenConstants.QueryMaximum, parameters);
PrintQueryTitle ("Query 3 - Most Expensive App for sale of all (without group by)");
Console.WriteLine (keenResponse.ToSafeString ());
PrintSeparator ();
Console.ReadKey ();
}
示例2: ReadKeyOnly_Success
public void ReadKeyOnly_Success()
{
var settings = new ProjectSettingsProvider(SettingsEnv.ProjectId, readKey: SettingsEnv.ReadKey);
var client = new KeenClient(settings);
if (!UseMocks)
{
// Server is required for this test
// Also, test depends on existance of collection "AddEventTest"
Assert.DoesNotThrow(() => client.Query(QueryType.Count(), "AddEventTest", ""));
}
}