org.springframework.social.facebook.api
Interface QuestionOperations


public interface QuestionOperations


Method Summary
 String addOption(String questionId, String optionText)
          Adds an option to a question.
 String askQuestion(String questionText)
          Publishes a question.
 void deleteOption(String optionId)
          Removes a question option.
 void deleteQuestion(String questionId)
          Removes a question.
 QuestionOption getOption(String optionId)
          Retrieves a question option.
 PagedList<QuestionOption> getOptions(String questionId)
          Retrieves all options for a specified question.
 Question getQuestion(String questionId)
          Retrieves a question.
 PagedList<Question> getQuestions()
          Retrieves all questions asked by the authenticated user.
 PagedList<Question> getQuestions(String userId)
          Retrieves all questions asked by the specified user.
 

Method Detail

askQuestion

String askQuestion(String questionText)
Publishes a question. Requires "publish_stream" permission.

Parameters:
questionText - the question text
Returns:
the ID of the newly created question
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "publish_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

addOption

String addOption(String questionId,
                 String optionText)
Adds an option to a question. Requires "publish_stream" permission.

Parameters:
questionId - the question to add the option to
optionText - the text of the option
Returns:
the ID of the newly created option
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "publish_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getQuestion

Question getQuestion(String questionId)
Retrieves a question. Requires "user_questions" permission to retrieve a question from the authenticated user and "friends_questions" to retrieve a question from one of the authenticated user's friends.

Parameters:
questionId - the ID of the question
Returns:
the Question
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "publish_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getQuestions

PagedList<Question> getQuestions()
Retrieves all questions asked by the authenticated user. Requires "user_questions" permission to retrieve questions from the authenticated user.

Returns:
a list of Questions
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "publish_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getQuestions

PagedList<Question> getQuestions(String userId)
Retrieves all questions asked by the specified user. Requires "user_questions" permission to retrieve questions from the authenticated user and "friends_questions" to retrieve questions from one of the authenticated user's friends.

Returns:
a list of Questions
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "publish_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

deleteQuestion

void deleteQuestion(String questionId)
Removes a question. Requires "publish_stream" permission.

Parameters:
questionId - the ID of the question to delete
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "publish_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getOption

QuestionOption getOption(String optionId)
Retrieves a question option. Requires "user_questions" permission to retrieve an option from the authenticated user and "friends_questions" to retrieve an option from one of the authenticated user's friends.

Parameters:
optionId - the ID of the option
Returns:
the QuestionOption
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "publish_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

getOptions

PagedList<QuestionOption> getOptions(String questionId)
Retrieves all options for a specified question. Requires "user_questions" permission to retrieve options from the authenticated user and "friends_questions" to retrieve options from one of the authenticated user's friends.

Parameters:
questionId - the ID of the question to retrieve options for
Returns:
a list of QuestionOptions
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "publish_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.

deleteOption

void deleteOption(String optionId)
Removes a question option. Requires "publish_stream" permission.

Parameters:
optionId - the ID of the option to delete
Throws:
org.springframework.social.ApiException - if there is an error while communicating with Facebook.
org.springframework.social.InsufficientPermissionException - if the user has not granted "publish_stream" permission.
org.springframework.social.MissingAuthorizationException - if FacebookTemplate was not created with an access token.