コード例 #1
0
ファイル: marketplace.cs プロジェクト: wsgan001/asegrp
        /// <summary>
        /// Returns the Marketplace subcategories for a particular category.
        /// </summary>
        /// <param name="category">Filter by category. If this is not a valid category, no subcategories get returned.</param>
        /// <returns>A list of subcategories for use in Marketplace. </returns>
        public IList <string> getSubCategories(string category)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.marketplace.getSubCategories" }
            };

            _api.AddRequiredParameter(parameterList, "category", category);

            var response = _api.SendRequest(parameterList);

            return(!string.IsNullOrEmpty(response) ? marketplace_getSubCategories_response.Parse(response).marketplace_subcategory : null);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public IList <comment> getComments(string post_id)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.stream.getComments" }
            };

            _api.AddRequiredParameter(parameterList, "post_id", post_id);

            var response = _api.SendRequest(parameterList);

            return(!string.IsNullOrEmpty(response) ? stream_getComments_response.Parse(response).comment : null);
        }
コード例 #3
0
ファイル: events.cs プロジェクト: wsgan001/asegrp
        /// <summary>
        /// Cancels the event
        /// </summary>
        /// <param name="eid">Unique identifier of event to cancel.</param>
        /// <param name="cancelMessage">string explaining why event was cancelled </param>
        /// <returns>If successful</returns>
        public bool cancel(long eid, string cancelMessage)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.events.cancel" }
            };

            _api.AddRequiredParameter(parameterList, "eid", eid);
            _api.AddOptionalParameter(parameterList, "cancel_message", cancelMessage);

            var response = _api.SendRequest(parameterList);

            return(!string.IsNullOrEmpty(response) ? events_cancel_response.Parse(response).TypedValue : false);
        }
コード例 #4
0
ファイル: permissions.cs プロジェクト: wsgan001/asegrp
        /// <summary>
        /// This method gives another application access to certain API calls on behalf of the application calling it. The application granted access is specified by permissions_apikey. Which methods or namespaces can be called are specified in method_arr.
        /// </summary>
        /// <param name="method_arr">JSON array of methods and/or namespaces for which the access is granted. If this is not specified, access to all allowed methods is granted.</param>
        /// <returns>The method returns a bool value indicating whether the call succeeded or failed. </returns>
        /// <remarks>The only namespace that can be granted access at this time is admin. </remarks>
        public bool grantApiAccess(string apiKeyGrantedAccess, List <string> method_arr)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.permissions.grantApiAccess" }
            };

            _api.AddRequiredParameter(parameterList, "permissions_apikey", apiKeyGrantedAccess);
            _api.AddJSONArray(parameterList, "method_arr", method_arr);

            var response = _api.SendRequest(parameterList);

            return(string.IsNullOrEmpty(response) || permissions_grantApiAccess_response.Parse(response).TypedValue);
        }
コード例 #5
0
        /// <summary>
        /// Adds a tag with the given information to a photo. See photo uploads for a description of the upload workflow.
        /// </summary>
        /// <param name="pid">The photo id of the photo to be tagged.</param>
        /// <param name="tag_uid">The user id of the user being tagged. Either tag_uid or tag_text must be specified.</param>
        /// <param name="tag_text">Some text identifying the person being tagged. Either tag_uid or tag_text must be specified. This parameter is ignored if tag_uid is specified.</param>
        /// <param name="x">The horizontal position of the tag, as a percentage from 0 to 100, from the left of the photo.</param>
        /// <param name="y">The vertical position of the tag, as a percentage from 0 to 100, from the top of the photo.</param>
        /// <param name="tags">A JSON-serialized array representing a list of tags to be added to the photo. If the tags parameter is specified, the x, y, tag_uid, and tag_text parameters are ignored. Each tag in the list must specify: "x", "y", and either the user id "tag_uid" or free-form "tag_text" identifying the person being tagged. An example of this is the string [{"x":"30.0","y":"30.0","tag_uid":1234567890}, {"x":"70.0","y":"70.0","tag_text":"some person"}].</param>
        /// <returns>True if successful, otherwise an error.</returns>
        /// <remarks>Tags can only be added to pending photos owned by the current session user. Once a photo has been approved or rejected, it can no longer be tagged with this method. There is a limit of 20 tags per pending photo.</remarks>
        public void addTag(long pid, long tag_uid, string tag_text, float x, float y)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.photos.addTag" }
            };

            _api.AddRequiredParameter(parameterList, "pid", pid);
            _api.AddOptionalParameter(parameterList, "tag_uid", tag_uid);
            _api.AddOptionalParameter(parameterList, "tag_text", tag_text);
            _api.AddRequiredParameter(parameterList, "x", x);
            _api.AddRequiredParameter(parameterList, "y", y);

            _api.SendRequest(parameterList);
        }
コード例 #6
0
        /// <summary>
        /// Returns specified daily metrics for your application, given a date range.
        /// </summary>
        /// <returns></returns>
        public IList <metrics> getMetrics(List <string> metrics, DateTime startDate, DateTime endDate, Period period)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.admin.getMetrics" }
            };

            _api.AddRequiredParameter(parameterList, "start_time", DateHelper.ConvertDateToDouble(startDate).ToString());
            _api.AddRequiredParameter(parameterList, "end_time", DateHelper.ConvertDateToDouble(endDate).ToString());
            _api.AddRequiredParameter(parameterList, "period", period.ToString("D"));
            _api.AddJSONArray(parameterList, "metrics", metrics);
            var response = _api.SendRequest(parameterList);

            return(!string.IsNullOrEmpty(response) ? admin_getMetrics_response.Parse(response).metrics : null);
        }
コード例 #7
0
        /// <summary>
        /// Associates a given "handle" with FBML markup so that the handle can be used within the fb:ref FBML tag. A handle is unique within an application and allows an application to publish identical FBML to many user profiles and do subsequent updates without having to republish FBML on behalf of each user. See the FBML documentation for a description of the markup and its role in various contexts.
        /// </summary>
        /// <param name="handle">Handle to associate with the given FBML.</param>
        /// <param name="fbml">FBML to associate with the given handle.</param>
        /// <returns>The result of the method call as a binary string.</returns>
        public bool setRefHandle(string handle, string fbml)
        {
            var parameterList = new Dictionary <string, string>
            {
                { "method", "facebook.fbml.setRefHandle" }
            };

            _api.AddRequiredParameter(parameterList, "handle", handle);
            _api.AddRequiredParameter(parameterList, "fbml", fbml);

            var response = _api.SendRequest(parameterList);

            return(string.IsNullOrEmpty(response) || fbml_setRefHandle_response.Parse(response).TypedValue);
        }
コード例 #8
0
ファイル: liveMessage.cs プロジェクト: wsgan001/asegrp
        /// <summary>
        /// Sends a live message to a particular user's browser, which should be handled in FBJS. Messages can only be sent and received by users who have accepted your application's Terms of Service.
        /// </summary>
        /// <param name="recipient">The message recipient. </param>
        /// <param name="event_name">Name of the "event" for which messages will be sent and received (max length: 128 bytes). A LiveMessage FBJS object must be initialized with this event name to receive the message. </param>
        /// <param name="message">A JSON-encoded string of the message to send (max length: 1024 bytes). </param>
        /// <returns>Boolean of success or failure.</returns>
        public bool send(long recipient, string event_name, string message)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.liveMessage.send" }
            };

            _api.AddRequiredParameter(parameterList, "recipient", recipient.ToString());
            _api.AddRequiredParameter(parameterList, "event_name", event_name);
            _api.AddJSONAssociativeArray(parameterList, "message", new Dictionary <string, string> {
                { "from", _api.uid.ToString() }, { "msg", message }
            });

            var response = _api.SendRequest(parameterList);

            return(string.IsNullOrEmpty(response) || liveMessage_send_response.Parse(response).TypedValue);
        }
コード例 #9
0
        /// <summary>
        /// Sends a direct FQL query to FB
        /// </summary>
        /// <param name="query">FQL Query</param>
        /// <returns>Result of the FQL query as an XML string</returns>
        public string query(string query)
        {
            var parameterList = new Dictionary <string, string>(3)
            {
                { "method", "facebook.fql.query" }
            };

            _api.AddRequiredParameter(parameterList, "query", query);

            return(_api.SendRequest(parameterList, true));
        }
コード例 #10
0
        /// <summary>
        /// Returns membership list data associated with a group.
        /// </summary>
        /// <param name="gid">Group id to return members for.</param>
        /// <returns>This method returns four (possibly empty) lists of users associated with a group, keyed on their associations. The members list will contain the officers and admins lists, but will not overlap with the not_replied list.</returns>
        public group_members getMembers(long gid)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.groups.getMembers" }
            };

            _api.AddRequiredParameter(parameterList, "gid", gid);
            var response = _api.SendRequest(parameterList);

            return(!string.IsNullOrEmpty(response) ? groups_getMembers_response.Parse(response).Content : null);
        }
コード例 #11
0
ファイル: pages.cs プロジェクト: wsgan001/asegrp
        /// <summary>
        /// Checks whether the logged-in user is the admin for a given page.
        /// </summary>
        /// <param name="page_id">The id of the page </param>
        /// <returns>True or False</returns>
        public bool isAdmin(long page_id)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.pages.isAdmin" }
            };

            _api.AddRequiredParameter(parameterList, "page_id", page_id);

            var response = _api.SendRequest(parameterList);

            return(string.IsNullOrEmpty(response) || pages_isAdmin_response.Parse(response).TypedValue);
        }
コード例 #12
0
ファイル: feed.cs プロジェクト: wsgan001/asegrp
        /// <summary>
        /// Publishes a Mini-Feed story to the user corresponding to the session_key parameter, and publishes News Feed stories to the friends of that user who have added the application.
        /// </summary>
        /// <param name="title_template">The templatized markup displayed in the feed story's title section. This template must contain the token {actor} somewhere in it.</param>
        /// <param name="title_data">Optional - A JSON-encoded associative array of the values that should be substituted into the templates in the title_template markup string. The keys of this array are the tokens, and their associated values are the desired substitutions. 'actor' and 'target' are special tokens and should not be included in this array. If your title_template contains tokens besides 'actor' and 'target', then this is a required parameter.</param>
        /// <param name="body_template">Optional - The markup displayed in the feed story's body section.</param>
        /// <param name="body_data">Optional - A JSON-encoded associative array of the values that should be substituted into the templates in the body_template markup string. The keys of this array are the tokens, and their associated values are the desired substitutions. 'actor' and 'target' are special token and should not be included in this array.</param>
        /// <param name="body_general">Optional - Additional markup displayed in the feed story's body section. This markup is not required to be identical for two stories to be aggregated. One of the two will be chosen at random.</param>
        /// <param name="page_actor_id">Optional - if publishing a story to a Facebook Page, use this parameter as the page who performed the action. If you use this parameter, the application must be added to that Page's Feed. A session key is not required to do this.</param>
        /// <param name="images"></param>
        /// <param name="target_ids"></param>
        /// <returns></returns>
        public bool publishTemplatizedAction(string title_template, Dictionary <string, string> title_data,
                                             string body_template, Dictionary <string, string> body_data,
                                             string body_general, int page_actor_id,
                                             Collection <feed_image> images, Collection <string> target_ids)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.feed.publishTemplatizedAction" }
            };

            _api.AddRequiredParameter(parameterList, "title_template", title_template);
            _api.AddOptionalParameter(parameterList, "page_actor_id", page_actor_id);
            _api.AddJSONAssociativeArray(parameterList, "title_data", title_data);
            _api.AddJSONAssociativeArray(parameterList, "body_data", body_data);
            _api.AddOptionalParameter(parameterList, "body_template", body_template);
            _api.AddOptionalParameter(parameterList, "body_general", body_general);
            _api.AddCollection(parameterList, "target_ids", target_ids);
            AddFeedImages(parameterList, images);

            var response = _api.SendRequest(parameterList);

            return(string.IsNullOrEmpty(response) || feed_publishTemplatizedAction_response.Parse(response).TypedValue);
        }
コード例 #13
0
        private string run(List <string> callList, bool isSerial)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.batch.run" }
            };

            _api.AddJSONArray(parameterList, "method_feed", callList);
            if (isSerial)
            {
                _api.AddRequiredParameter(parameterList, "serial_only", "1");
            }
            return(_api.SendRequest(parameterList, true));
        }
コード例 #14
0
ファイル: users.cs プロジェクト: wsgan001/asegrp
        /// <summary>
        /// Returns a wide array of user-specific information for each user identifier passed, limited by the view of the current user. The current user is determined from the session_key parameter. The only storable values returned from this call are the those under the affiliations element, the notes_count value, and the contents of the profile_update_time element.
        /// </summary>
        /// <param name="uids">List of user ids. This is a comma-separated list of user ids.</param>
        /// <returns>The user info elements returned are those friends visible to the Facebook Platform. If no visible users are found from the passed uids argument, the method will return an empty result element.</returns>
        public IList <user> getInfo(string uids)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.users.getInfo" }
            };

            _api.AddOptionalParameter(parameterList, "uids", uids);
            _api.AddRequiredParameter(parameterList, "fields",
                                      "first_name, last_name, name, pic_small, pic_big, pic_square, pic, affiliations, profile_update_time, timezone, religion, birthday, sex, hometown_location, meeting_sex, meeting_for, relationship_status, significant_other_id, political, current_location, activities, interests, is_app_user, music, tv, movies, books, quotes, about_me, hs_info, education_history, work_history, notes_count, wall_count, status");

            var response = _api.SendRequest(parameterList);

            return(!string.IsNullOrEmpty(response) ? users_getInfo_response.Parse(response).user : null);
        }
コード例 #15
0
ファイル: profile.cs プロジェクト: wsgan001/asegrp
        ///// <summary>
        ///// Returns the specified user's application info section for the calling application.
        ///// </summary>
        ///// <returns>The content returned is specified within info_fields.</returns>
        public profile_getInfo_response getInfo(long uid)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.profile.getInfo" }
            };

            _api.AddRequiredParameter(parameterList, "uid", uid);

            var response = _api.SendRequest(parameterList);

            return(!string.IsNullOrEmpty(response) ? profile_getInfo_response.Parse(response) : null);
        }