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


C# Search.setAccessToken方法代码示例

本文整理汇总了C#中Search.setAccessToken方法的典型用法代码示例。如果您正苦于以下问题:C# Search.setAccessToken方法的具体用法?C# Search.setAccessToken怎么用?C# Search.setAccessToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Search的用法示例。


在下文中一共展示了Search.setAccessToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getFBHistorical

        /// <summary>
        /// Get FB historical data from FB
        /// </summary>
        /// <param name="since">YYY-MM-DD string for start date</param>
        /// <param name="until">YYY-MM-DD string for end date</param>
        public void getFBHistorical(string since, string until)
        {
            Console.WriteLine("********** From " + since + " to " + until + " ************");
            Search searchChoreo = new Search(session);

            // Setup inputs for Temboo Facebook search
            searchChoreo.setObjectType("page");
            searchChoreo.setFields("insights.since("+since+").until("+until+")");
            searchChoreo.setAccessToken(accessToken);
            searchChoreo.setQuery("KeepItPumping");

            // Execute Choreo
            SearchResultSet searchResults = searchChoreo.execute();
            JObject json_insight = JObject.Parse(searchResults.Response);
            string name_token = (string)json_insight["data"][0]["insights"]["data"][0]["name"];
            json_insight = JObject.Parse(json_insight["data"][0].ToString());
            int i = 0;
            DateTime pull_date = DateTime.Now;

            // Set up call to historical processing
            ProcessFBDelegate pFBDel = new ProcessFBDelegate(processFBHistory);
            processInsight(pFBDel, json_insight, pull_date);
        }
开发者ID:Dointhefish,项目名称:KIP_Social_Media,代码行数:28,代码来源:Facebook.cs

示例2: getFacebookData

        /// <summary>
        /// Request and retrieve insights data.
        ///     Get the page ID with the Temboo lookup service
        ///     Get the insights data with the Temboo GetObject service
        /// </summary>
        public void getFacebookData()
        {
            /*
            URLLookup uRLLookupChoreo = new URLLookup(session);

            // Set inputs
            uRLLookupChoreo.setAccessToken(accessToken);
            uRLLookupChoreo.setIDs(pageURL);

            // Execute Choreo
            URLLookupResultSet uRLLookupResults = uRLLookupChoreo.execute();

            // Print results
            //Console.WriteLine(uRLLookupResults.Response);
            string s_lookup = uRLLookupResults.Response;
            JObject json_lookup = JObject.Parse(s_lookup);

            string page_id = (string)json_lookup[pageURL]["id"];
            Console.WriteLine("page ID = " + page_id);

            GetObject getObjectChoreo = new GetObject(session);

            // Set inputs
            getObjectChoreo.setAccessToken(accessToken);
            getObjectChoreo.setFields("insights");
            getObjectChoreo.setObjectID(page_id);

            // Execute GetObject Choreo
            GetObjectResultSet getObjectResults = getObjectChoreo.execute();

            // Print results
            //Console.WriteLine(getObjectResults.Response);

            //Put results in JSON object
            JObject json_insight = JObject.Parse(getObjectResults.Response);
            string name_token = (string)json_insight["insights"]["data"][0]["name"];
            int i = 0;
            DateTime pull_date = DateTime.Now;
            */
            Search searchChoreo = new Search(session);

            // Setup inputs for Temboo Facebook search
            string since = DateTime.Now.AddDays(-5).ToString("yyyy-MM-dd");
            string until = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
            searchChoreo.setObjectType("page");
            searchChoreo.setFields("insights.since(" + since + ").until(" + until + ")");
            searchChoreo.setAccessToken(accessToken);
            searchChoreo.setQuery("KeepItPumping");

            // Execute Choreo
            SearchResultSet searchResults = searchChoreo.execute();
            JObject json_insight = JObject.Parse(searchResults.Response);
            string name_token = (string)json_insight["data"][0]["insights"]["data"][0]["name"];
            json_insight = JObject.Parse(json_insight["data"][0].ToString());
            int i = 0;
            DateTime pull_date = DateTime.Now;

            //Set up to call realtime processing
            ProcessFBDelegate pFBDel = new ProcessFBDelegate(processFBField);
            processInsight(pFBDel, json_insight, pull_date);

            //Console.WriteLine("found data = " + saved_fields);
        }
开发者ID:Dointhefish,项目名称:KIP_Social_Media,代码行数:68,代码来源:Facebook.cs


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