Beispiel #1
0
        private IList <object> MultiqueryParsed(FqlMultiQueryInfo[] queries, bool isAsync, MultiqueryParsedCallback callback, Object state)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.fql.multiquery" }
            };
            var qdict = new Dictionary <string, string>();
            MultiQueryInfoState qstate = new MultiQueryInfoState()
            {
                Queries  = queries,
                Callback = callback,
            };

            foreach (FqlMultiQueryInfo query in queries)
            {
                qdict.Add(query.Key, query.Query);
            }
            Utilities.AddJSONAssociativeArray(parameterList, "queries", qdict);

            if (isAsync)
            {
                AsyncResult result = new AsyncResult(OnMultiQueryCompleted, qstate, state);
                SendRequestAsync(parameterList, !string.IsNullOrEmpty(Session.SessionKey), result);
                return(null);
            }

            var response = SendRequest <IList <object> >(parameterList, !string.IsNullOrEmpty(Session.SessionKey));

            return(response == null ? null : response);
        }
Beispiel #2
0
 /// <summary>
 /// Evaluates a series of FQL (Facebook Query Language) queries in one call and returns the data at one time.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.SessionSecret, Constants.SessionKey));
 ///     var query1 = string.Format("SELECT uid, name FROM user WHERE uid IN ({0})", Constants.UserId);
 ///     var query2 = string.Format("SELECT uid, name FROM user WHERE uid IN ({0})", Constants.UserId);
 ///     var queries = new Dictionary&lt;string, string&gt;();
 ///     queries.Add("firstQuery", query1);
 ///     queries.Add("secondQuery", query2);
 ///     api.Fql.MultiqueryAsync(queries, AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(IList&lt;fql_result&gt; result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="queries">A collection of the queries to perform. The array contains a set of key/value pairs. Each key is a query name, which can contain only alphanumeric characters and optional underscores. Each key maps to a value containing a traditional FQL query.</param>
 /// <param name="callback">The AsyncCallback delegate</param>
 /// <param name="state">An object containing state information for this asynchronous request</param>
 /// <returns>This call returns a List of query results. The keys returned are the names of the queries made.  As with fql.query, the data returned from each query very closely resembles the returns of other API calls like users.getInfo, as many API functions are simply wrappers for FQL queries.</returns>
 public void MultiqueryAsync(FqlMultiQueryInfo[] queries, MultiqueryParsedCallback callback, Object state)
 {
     MultiqueryParsed(queries, true, callback, state);
 }