All Downloads are FREE. Search and download functionalities are using the official Maven repository.

facebook4j.api.QuestionMethods Maven / Gradle / Ivy

There is a newer version: 2.4.13
Show newest version
/*
 * Copyright 2012 Ryuji Yamashita
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package facebook4j.api;

import java.util.List;

import facebook4j.FacebookException;
import facebook4j.Question;
import facebook4j.QuestionVotes;
import facebook4j.Reading;
import facebook4j.ResponseList;

/**
 * @author Ryuji Yamashita - roundrop at gmail.com
 */
public interface QuestionMethods {
    /**
     * Returns the current user's questions.
     * @return questions
     * @throws FacebookException when Facebook service or network is unavailable
     * @see User#questions - Facebook Developers
     */
    ResponseList getQuestions() throws FacebookException;

    /**
     * Returns the current user's questions.
     * @param reading optional reading parameters. see Graph API#reading - Facebook Developers
     * @return questions
     * @throws FacebookException when Facebook service or network is unavailable
     * @see User#questions - Facebook Developers
     */
    ResponseList getQuestions(Reading reading) throws FacebookException;

    /**
     * Returns a user's questions.
     * @param userId the ID of a user
     * @return questions
     * @throws FacebookException when Facebook service or network is unavailable
     * @see User#questions - Facebook Developers
     */
    ResponseList getQuestions(String userId) throws FacebookException;

    /**
     * Returns a user's questions.
     * @param userId the ID of a user
     * @param reading optional reading parameters. see Graph API#reading - Facebook Developers
     * @return questions
     * @throws FacebookException when Facebook service or network is unavailable
     * @see User#questions - Facebook Developers
     */
    ResponseList getQuestions(String userId, Reading reading) throws FacebookException;


    /**
     * Creates the question.
     * @param question the text of the question
     * @return The new question ID
     * @throws FacebookException when Facebook service or network is unavailable
     * @see User#questions - Facebook Developers
     */
    String createQuestion(String question) throws FacebookException;

    /**
     * Creates the question.
     * @param question the text of the question
     * @param options answer options
     * @param allowNewOptions true if allows other users to add new options
     * @return The new question ID
     * @throws FacebookException when Facebook service or network is unavailable
     * @see User#questions - Facebook Developers
     */
    String createQuestion(String question, List options, boolean allowNewOptions) throws FacebookException;

    /**
     * Creates the question.
     * @param userId the ID of a user
     * @param question the text of the question
     * @return The new question ID
     * @throws FacebookException when Facebook service or network is unavailable
     * @see User#questions - Facebook Developers
     */
    String createQuestion(String userId, String question) throws FacebookException;

    /**
     * Creates the question.
     * @param userId the ID of a user
     * @param question the text of the question
     * @param options answer options
     * @param allowNewOptions true if allows other users to add new options
     * @return The new question ID
     * @throws FacebookException when Facebook service or network is unavailable
     * @see User#questions - Facebook Developers
     */
    String createQuestion(String userId, String question, List options, boolean allowNewOptions) throws FacebookException;
    
    /**
     * Returns a single question.
     * @param questionId the ID of the question
     * @return question
     * @throws FacebookException when Facebook service or network is unavailable
     * @see Question - Facebook Developers
     */
    Question getQuestion(String questionId) throws FacebookException;

    /**
     * Returns a single question.
     * @param questionId the ID of the question
     * @param reading optional reading parameters. see Graph API#reading - Facebook Developers
     * @return question
     * @throws FacebookException when Facebook service or network is unavailable
     * @see Question - Facebook Developers
     */
    Question getQuestion(String questionId, Reading reading) throws FacebookException;
    

    /**
     * Deletes the question.
     * @param questionId the ID of the question
     * @return true if delete is successful
     * @throws FacebookException when Facebook service or network is unavailable
     * @see User#questions - Facebook Developers
     */
    boolean deleteQuestion(String questionId) throws FacebookException;


    /**
     * Returns the options available as answers to the question.
     * @param questionId the ID of the question
     * @return the options available as answers to the question
     * @throws FacebookException when Facebook service or network is unavailable
     * @see Question#options - Facebook Developers
     */
    ResponseList getQuestionOptions(String questionId) throws FacebookException;

    /**
     * Returns the options available as answers to the question.
     * @param questionId the ID of the question
     * @param reading optional reading parameters. see Graph API#reading - Facebook Developers
     * @return the options available as answers to the question
     * @throws FacebookException when Facebook service or network is unavailable
     * @see Question#options - Facebook Developers
     */
    ResponseList getQuestionOptions(String questionId, Reading reading) throws FacebookException;

    /**
     * Adds the option to a question.
     * @param questionId the ID of the question
     * @param optionDescription description
     * @return option ID
     * @throws FacebookException when Facebook service or network is unavailable
     * @see Question#options - Facebook Developers
     */
    String addQuestionOption(String questionId, String optionDescription) throws FacebookException;


    /**
     * Returns the votes a particular option to a question has received.
     * @param questionId the ID of the question
     * @return option of users who have voted for this specific option
     * @throws FacebookException when Facebook service or network is unavailable
     * @see QuestionOption - Facebook Developers
     */
    ResponseList getQuestionOptionVotes(String questionId) throws FacebookException;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy