当前位置: 首页>>代码示例>>C#>>正文


C# KeenClient.Query方法代码示例

本文整理汇总了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 ();

        }
开发者ID:hardikamal,项目名称:GooglePlayAppsCrawler,代码行数:48,代码来源:Analytics.cs

示例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", ""));
            }
        }
开发者ID:iturpablo,项目名称:keen-sdk-net,代码行数:12,代码来源:QueryTest.cs


注:本文中的Keen.Core.KeenClient.Query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。