/// <summary> /// Returns whether or not each pair of specified users is friends with each other. The first array specifies one half of each pair, the second array the other half; therefore, they must be of equal size. /// </summary> /// <param name="uids1">A list of user ids matched with uids2. This is a comma-separated list of user ids.</param> /// <param name="uids2">A list of user ids matched with uids1. This is a comma-separated list of user ids.</param> /// <returns>Returns a list of friend_info elements corresponding to the lists passed. The are_friends subelement of each friend_info element will be 0 if the users are not friends, and 1 if they are friends. For each pair, this function is symmetric (does not matter which user is in uids1 and which is in uids2).</returns> public IList <friend_info> areFriends(List <long> uids1, List <long> uids2) { var parameterList = new Dictionary <string, string> { { "method", "facebook.friends.areFriends" } }; _api.AddList(parameterList, "uids1", uids1); _api.AddList(parameterList, "uids2", uids2); var response = _api.SendRequest(parameterList); return(!string.IsNullOrEmpty(response) ? friends_areFriends_response.Parse(response).friend_info : null); }
/// <summary> /// Returns all visible photos according to the filters specified. This may be used to find all photos in which a user is tagged, return photos in a specific album, or to query specific pids. /// </summary> /// <param name="subj_id">Filter by photos tagged with this user.</param> /// <param name="aid">Filter by photos in this album.</param> /// <param name="pids">Filter by photos in this list. This is a comma-separated list of pids.</param> /// <returns>This method returns all visible photos satisfying the filters specified. The method can be used to return all photos tagged with user, in an album, query a specific set of photos by a list of pids, or filter on any combination of these three.</returns> /// <remarks>It is an error to omit all three of the subj_id, aid, and pids parameters. They have no defaults.</remarks> public IList <photo> get(string subj_id, long aid, List <long> pids) { var parameterList = new Dictionary <string, string> { { "method", "facebook.photos.get" } }; _api.AddOptionalParameter(parameterList, "subj_id", subj_id); _api.AddOptionalParameter(parameterList, "aid", aid); _api.AddList(parameterList, "pids", pids); var response = _api.SendRequest(parameterList); return(!string.IsNullOrEmpty(response) ? photos_get_response.Parse(response).photo : null); }
/// <summary> /// Returns all visible pages to the filters specified. This may be used to find all pages of which a user is a fan, or to query specific page_ids. The session_key parameter is optional. When the session_key parameter is not passed, you can only get information for pages that have added your application. The uid parameter is not even considered. With a session_key, normal privacy rules are put into place. /// </summary> /// <param name="fields">List of desired fields in return. This is a comma-separated list of field strings. </param> /// <param name="page_ids">List of page IDs. This is a comma-separated list of page IDs. </param> /// <param name="uid">The ID of the user. Defaults to the logged in user if the session_key is valid, and no page_ids are passed. Used to get the pages a given user is a fan of.</param> /// <returns>The page info elements returned are those visible to the Facebook Platform.</returns> public IList <page> getInfo(List <string> fields, List <long> page_ids, long?uid) { var parameterList = new Dictionary <string, string> { { "method", "facebook.pages.getInfo" } }; _api.AddList(parameterList, "fields", fields); _api.AddList(parameterList, "page_ids", page_ids); _api.AddOptionalParameter(parameterList, "uid", uid); var response = _api.SendRequest(parameterList); return(!string.IsNullOrEmpty(response) ? pages_getInfo_response.Parse(response).page : null); }
/// <summary> /// /// </summary> /// <returns></returns> public stream_data get(int viewer_id, List <string> source_ids, DateTime start_time, DateTime end_time, int limit, string filter_key) { var parameterList = new Dictionary <string, string> { { "method", "facebook.stream.get" } }; _api.AddOptionalParameter(parameterList, "viewer_id", viewer_id); _api.AddList(parameterList, "source_ids", source_ids); _api.AddOptionalParameter(parameterList, "start_time", DateHelper.ConvertDateToDouble(start_time)); _api.AddOptionalParameter(parameterList, "end_time", DateHelper.ConvertDateToDouble(end_time)); _api.AddOptionalParameter(parameterList, "limit", limit); _api.AddOptionalParameter(parameterList, "filter_key", filter_key); //var list = new List<string>(); //if (filters != null) //{ // foreach (var item in filters) // { // var dict = new Dictionary<string, string>{ // {"filter_key", item.filter_key}, // {"icon_url", item.icon_url}, // {"is_visible", item.is_visible.ToString()}, // {"name", item.name}, // {"rank", item.rank.ToString()}, // {"uid", item.uid.ToString()}, // {"value", item.value.ToString()}, // }; // list.Add(JSONHelper.ConvertToJSONAssociativeArray(dict)); // } //} //_api.AddJSONArray(parameterList, "filters", list); var response = _api.SendRequest(parameterList, true); return(!string.IsNullOrEmpty(response) ? stream_get_response.Parse(response).Content : null); }
/// <summary> /// Return all Marketplace listings either by listing ID or by user. /// </summary> /// /// <param name="uids">Filter by a list of users. If you leave this blank, then the list is filtered only for listing IDs.</param> /// <param name="listing_ids">Filter by listing IDs. If you leave this blank, then the list is filtered only for user IDs.</param> /// <returns>This method returns all visible listings matching the criteria given. If no matching listings are found, the method returns an empty element.</returns> public IList <listing> getListings(List <long> listing_ids, Collection <string> uids) { var parameterList = new Dictionary <string, string> { { "method", "facebook.marketplace.getListings" } }; _api.AddList(parameterList, "listing_ids", listing_ids); _api.AddCollection(parameterList, "uids", uids); var response = _api.SendRequest(parameterList); return(!string.IsNullOrEmpty(response) ? marketplace_getListings_response.Parse(response).listing : null); }
/// <summary> /// Returns all visible groups according to the filters specified. This may be used to find all groups of which a user is as member, or to query specific gids. /// </summary> /// <param name="uid">Filter by groups associated with a user with this uid</param> /// <param name="gids">Filter by this list of group ids. This is a comma-separated list of gids.</param> /// <returns>This method returns all groups satisfying the filters specified. The method can be used to return all groups associated with user, or query a specific set of events by a list of gids. If both the uid and gids parameters are provided, the method returns all groups in the set of gids, with which the user is associated. If the gids parameter is omitted, the method returns all groups associated with the provided user.</returns> /// <remarks>Group creators will be visible to an application only if the creator has not turned off access to the Platform or used the application'; If the creator has opted out, the creator element will appear as nil=true.</remarks> public IList <group> get(long uid, List <long> gids) { var parameterList = new Dictionary <string, string> { { "method", "facebook.groups.get" } }; _api.AddOptionalParameter(parameterList, "uid", uid); _api.AddList(parameterList, "gids", gids); var response = _api.SendRequest(parameterList); return(!string.IsNullOrEmpty(response) ? groups_get_response.Parse(response).group : null); }
/// <summary> /// http://wiki.developers.facebook.com/index.php/Feed.publishUserAction /// Publishes a story on behalf of the user owning the session, using the specified template bundle. /// An application can publish a maximum of 10 stories per user per day /// You can test your Feed templates using the Feed preview console (cf above wiki post). /// /// Use JSONHelper.ConvertToJSONArray and/or JSONHelper.ConvertToJSONAssociativeArray to add 'subarrays' in template_data /// /// Reserved tokens in template_data: /// actor /// target /// /// Special tokens in template_data: /// images: array of image. image: src, (optional)href /// flash: swfsrc, imgsrc, (optional)expanded_width, (optional)expanded_height /// mp3: src, (optional)title, (optional)artist, (optional)album /// video: video_src, preview_img, (optional)video_title, (optional)video_link, (optional)video_type (default:application/x-shockwave-flash) /// /// </summary> /// <param name="template_bundle_id">The template bundle ID used to identify a previously registered template bundle. The ID is the one returned by a previous call to feed.registerTemplateBundle.</param> /// <param name="template_data">Optional - A JSON-encoded associative array of the values that should be substituted into the templates.</param> /// <param name="target_ids">Optional - list of IDs of friends of the actor, used for stories about a direct action between the actor and the targets of his or her action.</param> /// <param name="body_general">Optional - Additional markup that extends the body of a short story.</param> /// <param name="story_size">Can be 1 (one line, default), 2 (short) or 4 (full).</param> /// <returns>true if all succeeds, and false if the user never authorized the application to publish to his or her Wall.</returns> public bool publishUserAction(long template_bundle_id, Dictionary <string, string> template_data, List <long> target_ids, string body_general, PublishedStorySize story_size) { var parameterList = new Dictionary <string, string> { { "method", "facebook.feed.publishUserAction" } }; _api.AddRequiredParameter(parameterList, "template_bundle_id", template_bundle_id); _api.AddJSONAssociativeArray(parameterList, "template_data", template_data); _api.AddList(parameterList, "target_ids", target_ids); _api.AddOptionalParameter(parameterList, "body_general", body_general); _api.AddOptionalParameter(parameterList, "story_size", (int)story_size); var response = _api.SendRequest(parameterList); return(string.IsNullOrEmpty(response) || feed_publishUserAction_response.Parse(response).TypedValue); }
/// <summary> /// Returns all visible events according to the filters specified. This may be used to find all events of a user, or to query specific eids. /// </summary> /// <param name="uid">Filter by events associated with a user with this uid.</param> /// <param name="eids">Filter by this list of event ids. This is a comma-separated list of eids.</param> /// <param name="start_time">Filter with this UTC as lower bound. A missing or zero parameter indicates no lower bound.</param> /// <param name="end_time">Filter with this UTC as upper bound. A missing or zero parameter indicates no upper bound.</param> /// <param name="rsvp_status">Filter by this RSVP status. attending,unsure,declined,not_replied </param> /// <returns>This method returns all events satisfying the filters specified. The method can be used to return all events associated with user, or query a specific set of events by a list of eids.</returns> public IList <facebookevent> get(long?uid, List <long> eids, DateTime?start_time, DateTime?end_time, string rsvp_status) { var parameterList = new Dictionary <string, string> { { "method", "facebook.events.get" } }; _api.AddOptionalParameter(parameterList, "uid", uid); _api.AddList(parameterList, "eids", eids); _api.AddOptionalParameter(parameterList, "start_time", DateHelper.ConvertDateToDouble(start_time)); _api.AddOptionalParameter(parameterList, "end_time", DateHelper.ConvertDateToDouble(end_time)); _api.AddOptionalParameter(parameterList, "rsvp_status", rsvp_status); var response = _api.SendRequest(parameterList); return(!string.IsNullOrEmpty(response) ? events_get_response.Parse(response).facebookevent : null); }