📄 ifacebookrestclient.java
字号:
/* +---------------------------------------------------------------------------+ | Facebook Development Platform Java Client | +---------------------------------------------------------------------------+ | Copyright (c) 2007 Facebook, Inc. | | All rights reserved. | | | | Redistribution and use in source and binary forms, with or without | | modification, are permitted provided that the following conditions | | are met: | | | | 1. Redistributions of source code must retain the above copyright | | notice, this list of conditions and the following disclaimer. | | 2. Redistributions in binary form must reproduce the above copyright | | notice, this list of conditions and the following disclaimer in the | | documentation and/or other materials provided with the distribution. | | | | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | +---------------------------------------------------------------------------+ | For help with this library, contact developers-help@facebook.com | +---------------------------------------------------------------------------+*/package com.facebook.api;import java.io.File;import java.io.IOException;import java.io.InputStream;import java.net.URL;import java.util.ArrayList;import java.util.Collection;import java.util.EnumSet;import java.util.Map;import java.util.Set;/** * Generic interface for a FacebookRestClient, parameterized by output format. * For continually updated documentation, please refer to the * <a href="http://wiki.developers.facebook.com/index.php/API"> * Developer Wiki</a>. */public interface IFacebookRestClient<T> { public static final String TARGET_API_VERSION = "1.0"; public static final String ERROR_TAG = "error_response"; public static final String FB_SERVER = "api.facebook.com/restserver.php"; public static final String SERVER_ADDR = "http://" + FB_SERVER; public static final String HTTPS_SERVER_ADDR = "https://" + FB_SERVER; public void setDebug(boolean isDebug); public boolean isDebug(); public boolean isDesktop(); public void setIsDesktop(boolean isDesktop); /** * Sets the FBML for a user's profile, including the content for both the profile box * and the profile actions. * @param userId - the user whose profile FBML to set * @param fbmlMarkup - refer to the FBML documentation for a description of the markup and its role in various contexts * @return a boolean indicating whether the FBML was successfully set */ public boolean profile_setFBML(CharSequence fbmlMarkup, Integer userId) throws FacebookException, IOException; /** * Gets the FBML for a user's profile, including the content for both the profile box * and the profile actions. * @param userId - the user whose profile FBML to set * @return a T containing FBML markup */ public T profile_getFBML(Integer userId) throws FacebookException, IOException; /** * Recaches the referenced url. * @param url string representing the URL to refresh * @return boolean indicating whether the refresh succeeded */ public boolean fbml_refreshRefUrl(String url) throws FacebookException, IOException; /** * Recaches the referenced url. * @param url the URL to refresh * @return boolean indicating whether the refresh succeeded */ public boolean fbml_refreshRefUrl(URL url) throws FacebookException, IOException; /** * Associates a "<code>handle</code>" with FBML markup so that the handle can be used within the * <a href="http://wiki.developers.facebook.com/index.php/Fb:ref">fb:ref</a> 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 for each user. * * @param handle - a string, unique within the application, that * @param fbmlMarkup - refer to the FBML documentation for a description of the markup and its role in various contexts * @return a boolean indicating whether the FBML was successfully set * @see <a href="http://wiki.developers.facebook.com/index.php/Fbml.setRefHandle"> * Developers Wiki: Fbml.setRefHandle</a> */ public boolean fbml_setRefHandle(CharSequence handle, CharSequence fbmlMarkup) throws FacebookException, IOException; /** * Recaches the image with the specified imageUrl. * @param imageUrl String representing the image URL to refresh * @return boolean indicating whether the refresh succeeded */ public boolean fbml_refreshImgSrc(String imageUrl) throws FacebookException, IOException; /** * Recaches the image with the specified imageUrl. * @param imageUrl the image URL to refresh * @return boolean indicating whether the refresh succeeded */ public boolean fbml_refreshImgSrc(URL imageUrl) throws FacebookException, IOException; /** * Publishes a Mini-Feed story describing an action taken by a user, and * publishes aggregating News Feed stories to the friends of that user. * Stories are identified as being combinable if they have matching templates and substituted values. * @param actorId the user into whose mini-feed the story is being published. * @param titleTemplate markup (up to 60 chars, tags excluded) for the feed story's title * section. Must include the token <code>{actor}</code>. * @return whether the action story was successfully published; false in case * of a permission error * @see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishTemplatizedAction"> * Developers Wiki: Feed.publishTemplatizedAction</a> * @see <a href="http://developers.facebook.com/tools.php?feed"> * Developers Resources: Feed Preview Console </a> */ public boolean feed_publishTemplatizedAction(Integer actorId, CharSequence titleTemplate) throws FacebookException, IOException; /** * Publishes a Mini-Feed story describing an action taken by a user, and * publishes aggregating News Feed stories to the friends of that user. * Stories are identified as being combinable if they have matching templates and substituted values. * @param actorId the user into whose mini-feed the story is being published. * @param titleTemplate markup (up to 60 chars, tags excluded) for the feed story's title * section. Must include the token <code>{actor}</code>. * @param titleData (optional) contains token-substitution mappings for tokens that appear in * titleTemplate. Should not contain mappings for the <code>{actor}</code> or * <code>{target}</code> tokens. Required if tokens other than <code>{actor}</code> * or <code>{target}</code> appear in the titleTemplate. * @param bodyTemplate (optional) markup to be displayed in the feed story's body section. * can include tokens, of the form <code>{token}</code>, to be substituted using * bodyData. * @param bodyData (optional) contains token-substitution mappings for tokens that appear in * bodyTemplate. Required if the bodyTemplate contains tokens other than <code>{actor}</code> * and <code>{target}</code>. * @param bodyGeneral (optional) additional body markup that is not aggregated. If multiple instances * of this templated story are combined together, the markup in the bodyGeneral of * one of their stories may be displayed. * @param targetIds The user ids of friends of the actor, used for stories about a direct action between * the actor and these targets of his/her action. Required if either the titleTemplate or bodyTemplate * includes the token <code>{target}</code>. * @param images (optional) additional body markup that is not aggregated. If multiple instances * of this templated story are combined together, the markup in the bodyGeneral of * one of their stories may be displayed. * @return whether the action story was successfully published; false in case * of a permission error * @see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishTemplatizedAction"> * Developers Wiki: Feed.publishTemplatizedAction</a> * @see <a href="http://developers.facebook.com/tools.php?feed"> * Developers Resources: Feed Preview Console </a> */ public boolean feed_publishTemplatizedAction(Integer actorId, CharSequence titleTemplate, Map<String,CharSequence> titleData, CharSequence bodyTemplate, Map<String,CharSequence> bodyData, CharSequence bodyGeneral, Collection<Integer> targetIds, Collection<IFeedImage> images ) throws FacebookException, IOException; /** * Publish the notification of an action taken by a user to newsfeed. * @param title the title of the feed story (up to 60 characters, excluding tags) * @param body (optional) the body of the feed story (up to 200 characters, excluding tags) * @param images (optional) up to four pairs of image URLs and (possibly null) link URLs * @return whether the story was successfully published; false in case of permission error * @see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishActionOfUser"> * Developers Wiki: Feed.publishActionOfUser</a> */ public boolean feed_publishActionOfUser(CharSequence title, CharSequence body, Collection<IFeedImage> images) throws FacebookException, IOException; /** * Publish the notification of an action taken by a user to newsfeed. * @param title the title of the feed story (up to 60 characters, excluding tags) * @param body (optional) the body of the feed story (up to 200 characters, excluding tags) * @return whether the story was successfully published; false in case of permission error * @see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishActionOfUser"> * Developers Wiki: Feed.publishActionOfUser</a> */ public boolean feed_publishActionOfUser(CharSequence title, CharSequence body) throws FacebookException, IOException; /** * Publish a story to the logged-in user's newsfeed. * @param title the title of the feed story * @param body the body of the feed story * @param images (optional) up to four pairs of image URLs and (possibly null) link URLs * @param priority * @return whether the story was successfully published; false in case of permission error * @see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishStoryToUser"> * Developers Wiki: Feed.publishStoryToUser</a> */ public boolean feed_publishStoryToUser(CharSequence title, CharSequence body, Collection<IFeedImage> images, Integer priority) throws FacebookException, IOException; /** * Publish a story to the logged-in user's newsfeed. * @param title the title of the feed story * @param body the body of the feed story * @return whether the story was successfully published; false in case of permission error * @see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishStoryToUser"> * Developers Wiki: Feed.publishStoryToUser</a> */ public boolean feed_publishStoryToUser(CharSequence title, CharSequence body) throws FacebookException, IOException; /** * Publish a story to the logged-in user's newsfeed. * @param title the title of the feed story * @param body the body of the feed story * @param priority * @return whether the story was successfully published; false in case of permission error * @see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishStoryToUser"> * Developers Wiki: Feed.publishStoryToUser</a>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -