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