<commit_before>// Most of the codes of this FacebookExtensions.cs file is taken from
// http://hernan.amiune.com/labs/facebook/c-sharp-facebook-graph-api-library.html
//
//
// Copyright 2010 <NAME> (h<EMAIL>)
// Licensed under MIT license:
// http://www.opensource.org/licenses/mit-license.php
// 
// Requires Newtonsoft.Json.Linq.JObject
// http://james.newtonking.com/projects/json-net.aspx
// Based on the Official Python client library for the Facebook Platform
// http://github.com/facebook/python-sdk/
// 
// C# client library for the Facebook Platform
// 
// This client library is designed to support the Graph API and the official
// Facebook JavaScript SDK, which is the canonical way to implement
// Facebook authentication. Read more about the Graph API at
// http://developers.facebook.com/docs/api. You can download the Facebook
// JavaScript SDK at http://github.com/facebook/connect-js/.
// 
using System.Collections.Generic;
using System.Text;

namespace FacebookSharp
{
    public static class FacebookExtensions
    {
        /// <summary>
        /// Fetches the give object from the graph.
        /// </summary>
        /// <param name="facebook"></param>
        /// <param name="id">Id of the object to fetch.</param>
        /// <param name="parameters">List of arguments.</param>
        /// <returns>The required object</returns>
        public static string GetObject(this Facebook facebook, string id, IDictionary<string, string> parameters)
        {
            return facebook.Request(id, parameters);
        }

        /// <summary>
        /// Fetches all of the give object from the graph.
        /// </summary>
        /// <param name="facebook"></param>
        /// <param name="parameters">List of arguments.</param>
        /// <param name="ids">Ids of the objects to return.</param>
        /// <returns>A map from ID to object. If any of the IDs are invalid, an exception is raised.</returns>
        public static string GetObjects(this Facebook facebook, IDictionary<string, string> parameters, params  string[] ids)
        {
            StringBuilder joinedIds = new StringBuilder();
            for (int i = 0; i < ids.Length; i++)
            {
                if (i == 0)
                    joinedIds.Append(ids[i]);
                else
                    joinedIds.AppendFormat(",{0}", ids[i]);
            }

            if (parameters == null)
                parameters = new Dictionary<string, string>();
            parameters["ids"] = joinedIds.ToString();

            return facebook.Request(null, parameters);
        }

        /// <summary>
        /// Fetches the connections for given object.
        /// </summary>
        /// <param name="facebook"></param>
        /// <param name="id">Id of the object to fetch.</param>
        /// <param name="connectionName">Name of the connection.</param>
        /// <param name="parameters">List of arguments.</param>
        /// <returns>Returns the connections.</returns>
        public static string GetConnections(this Facebook facebook, string id, string connectionName, IDictionary<string, string> parameters)
        {
            return facebook.Request(id + "/" + connectionName, parameters);
        }

        /// <summary>
        /// Writes the give object to the graph, connected to the give parent.
        /// </summary>
        /// <param name="facebook"></param>
        /// <param name="parentObject">The parent object.</param>
        /// <param name="connectionName">Name of the connection.</param>
        /// <param name="parameters">List of arguments.</param>
        /// <returns>Result of operation</returns>
        /// <remarks>
        /// For example,
        /// 
        ///     var data = new Dictionary<string, string>();
        ///     data.Add("message", "Hello, world");
        ///     facebook.PutObject("me", "feed", data);
        /// 
        /// writes "Hello, world" to the active user's wall.
        /// 
        /// See http://developers.facebook.com/docs/api#publishing for all of
        /// the supported writeable objects.
        /// 
        /// Most write operations require extended permissions. For example,
        /// publishing wall posts requires the "publish_stream" permission. See
        /// http://developers.facebook.com/docs/authentication/ for details about
        /// extended permissions.
        /// </remarks>
        public static string PutObject(this Facebook facebook, string parentObject, string connectionName, IDictionary<string, string> parameters)
        {
            if (!facebook.IsSessionValid())
                throw new FacebookSharpException("AccessToken required.");
            return facebook.Request(parentObject + "/" + connectionName, parameters, "POST");
        }

        /// <summary>
        /// Writes a wall post to current user wall.
        /// </summary>
        /// <param name="facebook"></param>
        /// <param name="message">The message to put on the wall.</param>
        /// <param name="parameters">Optional parameters for the message.</param>
        /// <returns>Result of the operation.</returns>
        /// <remarks>
        /// Default to writing to the authenticated user's wall if no
        /// profile_id is specified.
        /// 
        /// attachment adds a structured attachment to the status message being
        /// posted to the Wall. It should be a dictionary of the form:
        /// 
        ///     {"name": "Link name"
        ///      "link": "http://www.example.com/",
        ///      "caption": "{*actor*} posted a new review",
        ///      "description": "This is a longer description of the attachment",
        ///      "picture": "http://www.example.com/thumbnail.jpg"}
        /// </remarks>
        public static string PutWallPost(Facebook facebook, string message, IDictionary<string, string> parameters)
        {
            if (parameters != null)<commit_msg>* PutWallPost<commit_after>// Most of the codes of this FacebookExtensions.cs file is taken from
// http://hernan.amiune.com/labs/facebook/c-sharp-facebook-graph-api-library.html
//
//
// Copyright 2010 <NAME> (hernan.amiune.com)
// Licensed under MIT license:
// http://www.opensource.org/licenses/mit-license.php
// 
// Requires Newtonsoft.Json.Linq.JObject
// http://james.newtonking.com/projects/json-net.aspx
// Based on the Official Python client library for the Facebook Platform
// http://github.com/facebook/python-sdk/
// 
// C# client library for the Facebook Platform
// 
// This client library is designed to support the Graph API and the official
// Facebook JavaScript SDK, which is the canonical way to implement
// Facebook authentication. Read more about the Graph API at
// http://developers.facebook.com/docs/api. You can download the Facebook
// JavaScript SDK at http://github.com/facebook/connect-js/.
// 
using System.Collections.Generic;
using System.Text;

namespace FacebookSharp
{
    public static class FacebookExtensions
    {
        /// <summary>
        /// Fetches the give object from the graph.
        /// </summary>
        /// <param name="facebook"></param>
        /// <param name="id">Id of the object to fetch.</param>
        /// <param name="parameters">List of arguments.</param>
        /// <returns>The required object</returns>
        public static string GetObject(this Facebook facebook, string id, IDictionary<string, string> parameters)
        {
            return facebook.Request(id, parameters);
        }

        /// <summary>
        /// Fetches all of the give object from the graph.
        /// </summary>
        /// <param name="facebook"></param>
        /// <param name="parameters">List of arguments.</param>
        /// <param name="ids">Ids of the objects to return.</param>
        /// <returns>A map from ID to object. If any of the IDs are invalid, an exception is raised.</returns>
        public static string GetObjects(this Facebook facebook, IDictionary<string, string> parameters, params  string[] ids)
        {
            StringBuilder joinedIds = new StringBuilder();
            for (int i = 0; i < ids.Length; i++)
            {
                if (i == 0)
                    joinedIds.Append(ids[i]);
                else
                    joinedIds.AppendFormat(",{0}", ids[i]);
            }

            if (parameters == null)
                parameters = new Dictionary<string, string>();
            parameters["ids"] = joinedIds.ToString();

            return facebook.Request(null, parameters);
        }

        /// <summary>
        /// Fetches the connections for given object.
        /// </summary>
        /// <param name="facebook"></param>
        /// <param name="id">Id of the object to fetch.</param>
        /// <param name="connectionName">Name of the connection.</param>
        /// <param name="parameters">List of arguments.</param>
        /// <returns>Returns the connections.</returns>
        public static string GetConnections(this Facebook facebook, string id, string connectionName, IDictionary<string, string> parameters)
        {
            return facebook.Request(id + "/" + connectionName, parameters);
        }

        /// <summary>
        /// Writes the give object to the graph, connected to the give parent.
        /// </summary>
        /// <param name="facebook"></param>
        /// <param name="parentObject">The parent object.</param>
        /// <param name="connectionName">Name of the connection.</param>
        /// <param name="parameters">List of arguments.</param>
        /// <returns>Result of operation</returns>
        /// <remarks>
        /// For example,
        /// 
        ///     var data = new Dictionary<string, string>();
        ///     data.Add("message", "Hello, world");
        ///     facebook.PutObject("me", "feed", data);
        /// 
        /// writes "Hello, world" to the active user's wall.
        /// 
        /// See http://developers.facebook.com/docs/api#publishing for all of
        /// the supported writeable objects.
        /// 
        /// Most write operations require extended permissions. For example,
        /// publishing wall posts requires the "publish_stream" permission. See
        /// http://developers.facebook.com/docs/authentication/ for details about
        /// extended permissions.
        /// </remarks>
        public static string PutObject(this Facebook facebook, string parentObject, string connectionName, IDictionary<string, string> parameters)
        {
            if (!facebook.IsSessionValid())
                throw new FacebookSharpException("AccessToken required.");
            return facebook.Request(parentObject + "/" + connectionName, parameters, "POST");
        }

        /// <summary>
        /// Writes a wall post to current user wall.
        /// </summary>
        /// <param name="facebook"></param>
        /// <param name="message">The message to put on the wall.</param>
        /// <param name="parameters">Optional parameters for the message.</param>
        /// <returns>Result of the operation.</returns>
        /// <remarks>
        /// Default to writing to the authenticated user's wall if no
        /// profile_id is specified.
        /// 
        /// attachment adds a structured attachment to the status message being
        /// posted to the Wall. It should be a dictionary of the form:
        /// 
        ///     {"name": "Link name"
        ///      "link": "http://www.example.com/",
        ///      "caption": "{*actor*} posted a new review",
        ///      "description": "This is a longer description of the attachment",
        ///      "picture": "http://www.example.com/thumbnail.jpg"}
        /// </remarks>
        public static string PutWallPost(this Facebook facebook, string message, IDictionary<string, string> parameters)
        {
            if (parameters != null)
{'fraction_non_alphanumeric': 0.13548332771977098, 'fraction_numerical': 0.0011788480970023577, 'mean_word_length': 2.049293966623877, 'pattern_counts': {'":': 10, '<': 138, '<?xml version=': 0, '>': 136, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4725887', 'n_tokens_mistral': 2955, 'n_tokens_neox': 2882, 'n_words': 953}